Skip sort in druid


Do we have something like skip limit in druid ?

I basically want to use it for including pagination while showing the data in UI.Intially, I will show only top 10 results in page 1.Then, once the user selects page 2 ,it will show results between 10 and 20 and so on. Can this be done ?

Hey Ritesh,

Lexicographic topNs (see and select queries ( do natively allow pagination.

You may be able to get a groupBy query to paginate using limits + having specs, but the full resultset (all pages) needs to be computed on the broker to generate the first page, so you will not see much efficiency gain there relative to just doing an unlimited query.

Hi, thanks for the info. But, i need to skip results based on volume. For, example I need the top 10 storename with highest sale, so page 1 will have top 10 stores with respect to volume and 2nd will have next top 10, that is from 11th to 20th and so on. Here, volume will be a integer value. “lexicographic” or “alphaNumeric” uses “previousStop”. How to use it for skipping an integer value, since i won’t be knowing the count till the query hits the db.

Also, in havingSpec we need to provide value which are greater than less than etc, How, that can be used to skip the first 10 results or so? I need something like what mongodb provides where i can skip few results. Is there any way to do it ?

Hi Ritesh, you can look into building pagination at the client side and issuing topN for top 1000 or top 10000 and having the application create pages for the results. The thing to be careful of is when the cardinality of the dimension is very high.