Pagination With Druid Select Query

Hi Team - I am struggling to set up pagination with Druid select query.

With current implementation, we are required to provide druid with last offset and threshold value which does not work if i have data on multiple partitions and want to go from page 1 to directly page 10 (wtih specific page size).

I also thought of having only previous and next buttons for pagination but i am not sure how to get previous records.


Arpan Khagram

+91 8308993200

Hey Arpan,

The sort of pagination that allows skipping pages is usually done with LIMIT … OFFSET …, and is “evil” in the sense that it forces the database to compute and then throw away rows up to the offset. If you can work infinite scrolling into your UI, that should work best since it will lead to paginating select in-order in a natural way. If not, then prev/next should work but you’d want to remember all the old paging specs in case someone clicks “prev” a bunch of times.

Thanks Gian.

Yes we ended up implementing pre/next functions for druid data where we are maintaining all the previous paginating identifiers if someone click on next multiple times :slight_smile: