you are already sorting on date..and that can be best candidate for paging too.... but u may need indexes in both direction(asc,desc) for creation date.
lets say ur entity has fololowing prooerty on which u will fliter propA propB creationData so u will write basic query like select * from entity where propA='something' and propB='xyz' order by creationDate asc. once you get this result, keep this first record's creation date and last record's date, may be send it to client and attach it to prev, next links. At this stage prev will be null(as its start of the paging.i.e. first page) and next will be creation date of last record. If user click Next execute a query like this select * from entity where propA='something' and propB='xyz' and creationDate>dateSuppliedByClient order by creationDate asc..Here dateSuppliedByClient is creationDate of last record of above query. again do the same thing bind the creationDate first record to previous and last record to Next. so for every next you will keep executing second query now if user click previous, then execute bit different query select * from entity where propA='something' and propB='xyz' and creationDate<dateSuppliedByClient order by creationDate *desc*.Here dateSuppliedByClient is creationDate of first record of above query. NOTE : creationDate condition clause has changed and sorting order has changed So u will have following Indexes propA ^ propB^ creationDate^ propA ^ propB^ creationDate(Desc) On Thu, Jun 10, 2010 at 7:34 PM, RAVINDER MAAN <rsmaan...@gmail.com> wrote: > I forsee that there will be around 1000000 records or entities in one > table.I have to do filtering based on one or two ,sorting based on creation > date then display results through pagination with back and forth traversing > of records.so what will be the best strategy in this case. > > > On Thu, Jun 10, 2010 at 10:31 PM, Nacho Coloma <icol...@gmail.com> wrote: > >> Cursors is the best choice, but they can only be used to paginate >> forward. You will have to use your own hacks to allow more than one >> page. setRange() is more flexible, but should give you worse >> performance. >> >> On Jun 10, 3:27 pm, RAVINDER MAAN <rsmaan...@gmail.com> wrote: >> > I am using JDO .So which option is best cursors or setRange? >> > >> > >> > >> > >> > >> > On Wed, Jun 9, 2010 at 1:47 PM, Nacho Coloma <icol...@gmail.com> wrote: >> > > You should specify if you are using JDO, JPA or other. SimpleDS has a >> > > PagedQuery implementation that can be ported to your own environment. >> > > Look for getFetchOptions() in this link: >> > >> > >http://code.google.com/p/simpleds/source/browse/trunk/src/main/java/o. >> .. >> > >> > > This will only resolve the paging, and it's not optimal but convenient >> > > (can jump to a specific page etc). For an optimal solution, use >> > > cursors. >> > >> > > On Jun 9, 7:36 am, RAVINDER MAAN <rsmaan...@gmail.com> wrote: >> > > > Hello all >> > > > how can i get my query result sorted based on creationdate and >> > > > also i want to do pagination for the same.what is the best way to do >> > > > that.can anybody refer me any example code? >> > > > Thanks >> >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "Google App Engine for Java" group. >> >> > > To post to this group, send email to >> > > google-appengine-j...@googlegroups.com. >> >> > > To unsubscribe from this group, send email to >> > > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com><google-appengine-java%2B >> unsubscr...@googlegroups.com> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/google-appengine-java?hl=en. >> > >> > -- >> > Regards, >> > Ravinder Singh Maan >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine for Java" group. >> To post to this group, send email to >> google-appengine-j...@googlegroups.com. >> To unsubscribe from this group, send email to >> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-appengine-java?hl=en. >> >> > > > -- > Regards, > Ravinder Singh Maan > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.