Re: [google-appengine] Confuse about which is better solution to pagination using datastore on Python App Engine

21 views
Skip to first unread message

Karl MacMillan

unread,
Jul 6, 2015, 10:15:30 AM7/6/15
to google-a...@googlegroups.com, google-a...@googlegroups.com

On Jul 6, 2015, at 4:22 AM, Zeck Li <hateme...@gmail.com> wrote:

Here comes my question. What is the advantages of using cursor ?
Both two solutions all need to execute MyModel.gql(...)to get all data, and the first solution still need to execute with_cursor(...)to retrieve items.
It makes me so confused.


In the most basic terms, when you use a cursor the query can start from where it left off. With your other solution it will have to execute a new query, start the beginning of the results, and seek until it gets to the starting point for that page. If you are deep into a result set that seeking can waste quite a bit of time.

Karl

If you have better solutions or any suggestions for improving my solution, please share with me !!

-- 
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/9afe6644-db6e-461a-aaca-e5990da0d6c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages