I have input data of the format

Timestamp,User Id,Page Id

where each input tuple represent a page visit by a user.

Given the cardinality of “UserId” and “PageId” could be huge what is the effective way of querying this data if i want to get result of the following query :

“How many users have visited exactly 3 unique Pages?”.

For eg: if input it this :

2016-02-09, U1,P1

2016-02-09, U2,P1

2016-02-09, U1,P2

2016-02-09, U1,P3

2016-02-09, U2,P2

2016-02-09, U2,P1

In this case answer should be 1 user(i.e U1) has visited exactly 3 unique pages(P1,P2,P3)

Is there a way to do such analysis in druid?