Pagination With Druid Select Query

673 views
Skip to first unread message

Arpan Khagram

unread,
Jan 27, 2017, 2:42:42 AM1/27/17
to Druid User, davi...@imply.io
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.

Regards,
Arpan Khagram

Gian Merlino

unread,
Jan 31, 2017, 11:31:48 AM1/31/17
to druid...@googlegroups.com
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.

Gian

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+unsubscribe@googlegroups.com.
To post to this group, send email to druid...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/druid-user/41dfa138-a88a-4306-8b7f-73cf564b4c75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arpan Khagram

unread,
Feb 8, 2017, 7:32:07 AM2/8/17
to Druid User
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 :)


On Tuesday, January 31, 2017 at 4:31:48 PM UTC, Gian Merlino wrote:
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.

Gian

On Thu, Jan 26, 2017 at 11:42 PM, Arpan Khagram <arpan.kh...@gmail.com> wrote:
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.

Regards,
Arpan Khagram

--
You received this message because you are subscribed to the Google Groups "Druid User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to druid-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages