[google-appengine] Re: datastore .order question

2008-10-13 Thread David Wilson (entertainment cloud)

ok, i wanted to be sure about this, as pulling all the records and
just returning one would have been a performance disaster for my app.

my question was raised because i was a little surprised to read that
offset queries still pull all the 'upto' offset out of the store.

does the same apply to Thing.all().filter('value '  x).get()  ?

and thus is it possible to page without pulling all the previous pages
data from the store each time?



On Oct 13, 1:01 pm, Sylvain [EMAIL PROTECTED] wrote:
 Only '1'

 http://code.google.com/appengine/docs/datastore/queryclass.html#Query...

 On 13 oct, 13:41, David Wilson (entertainment cloud)

 [EMAIL PROTECTED] wrote:
  Hi,

  class Thing(db.Model):

      value = db.IntegerProperty(required=True)

  datastore has 10 Things with value 1..10

  Question:

  How many records does the query Thing.all().order('-value').get() pull
  from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: datastore .order question

2008-10-13 Thread yejun

It will only pull unnecessary data when you use offset parameter in
fetch(limit,offset=0). Because when you set an offset, the datastore
still need to iterate all previous data before that offset.

On Oct 13, 1:25 pm, David Wilson (entertainment cloud)
[EMAIL PROTECTED] wrote:
 when you say the same is not true of filter, are you saying that

 Thing.all().filter('value '  5).get()

 will pull Things 1,2,3,4,5(like the offset issue) the records from the
 datastore, but just return Things 6 from the query.

 this seems wrong to me.

 The reason im making sure on this is that my Thing has a large Blob in
 it that i really need to make sure is not getting pulled apart from
 the ones im displaying at the time. Otherwise i will split up the
 model and put an id in the Thing to a new model ThingBlob.

 On Oct 13, 5:34 pm, Marzia Niccolai [EMAIL PROTECTED] wrote:

  Hi,

  The same is not true of filter().  Filter will start at the first value
  larger than x, and should be used if you want to paginate your records.

  Brett Slatkin's IO talk covers scalable pagination recipes, and I suggest
  checking it 
  out:http://sites.google.com/site/io/building-scalable-web-applications-wi...

  -Marzia

  On Mon, Oct 13, 2008 at 6:24 AM, David Wilson (entertainment cloud) 

  [EMAIL PROTECTED] wrote:

   ok, i wanted to be sure about this, as pulling all the records and
   just returning one would have been a performance disaster for my app.

   my question was raised because i was a little surprised to read that
   offset queries still pull all the 'upto' offset out of the store.

   does the same apply to Thing.all().filter('value '  x).get()  ?

   and thus is it possible to page without pulling all the previous pages
   data from the store each time?

   On Oct 13, 1:01 pm, Sylvain [EMAIL PROTECTED] wrote:
Only '1'

   http://code.google.com/appengine/docs/datastore/queryclass.html#Query...

On 13 oct, 13:41, David Wilson (entertainment cloud)

[EMAIL PROTECTED] wrote:
 Hi,

 class Thing(db.Model):

     value = db.IntegerProperty(required=True)

 datastore has 10 Things with value 1..10

 Question:

 How many records does the query Thing.all().order('-value').get() pull
 from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: datastore .order question

2008-10-13 Thread David Wilson (entertainment cloud)


good news all round :) thanks for clearing that up everyone.


On Oct 13, 7:05 pm, yejun [EMAIL PROTECTED] wrote:
 It will only pull unnecessary data when you use offset parameter in
 fetch(limit,offset=0). Because when you set an offset, the datastore
 still need to iterate all previous data before that offset.

 On Oct 13, 1:25 pm, David Wilson (entertainment cloud)

 [EMAIL PROTECTED] wrote:
  when you say the same is not true of filter, are you saying that

  Thing.all().filter('value '  5).get()

  will pull Things 1,2,3,4,5(like the offset issue) the records from the
  datastore, but just return Things 6 from the query.

  this seems wrong to me.

  The reason im making sure on this is that my Thing has a large Blob in
  it that i really need to make sure is not getting pulled apart from
  the ones im displaying at the time. Otherwise i will split up the
  model and put an id in the Thing to a new model ThingBlob.

  On Oct 13, 5:34 pm, Marzia Niccolai [EMAIL PROTECTED] wrote:

   Hi,

   The same is not true of filter().  Filter will start at the first value
   larger than x, and should be used if you want to paginate your records.

   Brett Slatkin's IO talk covers scalable pagination recipes, and I suggest
   checking it 
   out:http://sites.google.com/site/io/building-scalable-web-applications-wi...

   -Marzia

   On Mon, Oct 13, 2008 at 6:24 AM, David Wilson (entertainment cloud) 

   [EMAIL PROTECTED] wrote:

ok, i wanted to be sure about this, as pulling all the records and
just returning one would have been a performance disaster for my app.

my question was raised because i was a little surprised to read that
offset queries still pull all the 'upto' offset out of the store.

does the same apply to Thing.all().filter('value '  x).get()  ?

and thus is it possible to page without pulling all the previous pages
data from the store each time?

On Oct 13, 1:01 pm, Sylvain [EMAIL PROTECTED] wrote:
 Only '1'

http://code.google.com/appengine/docs/datastore/queryclass.html#Query...

 On 13 oct, 13:41, David Wilson (entertainment cloud)

 [EMAIL PROTECTED] wrote:
  Hi,

  class Thing(db.Model):

      value = db.IntegerProperty(required=True)

  datastore has 10 Things with value 1..10

  Question:

  How many records does the query Thing.all().order('-value').get() 
  pull
  from the datastore?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---