design - Token to the next page in pagination API -


i have list of records on server sorted key , use pagination api return list of segments 1 one. since items can inserted in middle of list, return first key of next page pagination token has passed next page.

however, i've found dynamodb uses last key of current page instead querying api, null if next page not exist.

question:

what pros , cons between using last item of current page , first item of next page pagination token?

n.b:

as me returning first item more intuitive since it's null if next page not exist.

using "last item of current page" (licp) better using "first item of next page" (finp) because deals better possibility that, in meantime, item inserted between these 2 items.

for example suppose first page contains 3 alphabetically ordered names: adam/basil/claude. , suppose next page elon/francis/gilbert.

then licp token claude, while finp token elon. if no new names inserted, result same when next page.

however, suppose insert name daniel after getting first page before getting second page. in case, when second page licp daniel/elon/francis, while finp elon/francis/gilbert. say, licp miss daniel, while finp not.

also, finp may consume more computing resources licp, since must retrieve 1 item (4 items, in above example, instead of 3).


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -