[google-appengine] Re: a query log?

2010-10-07 Thread Grant
Hi

I do not think there is a query log, but you can use the fact that the
datastore only every queries an index to simulate one...

http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html

There is an implicit index on all (actually most) properties on any
entity and those indexes are used when you query a single property on
an entity e.g. [FROM person WHERE age = 18]

To do a more complex query e.g. [FROM person WHERE country_code = 'ZA'
AND age  18] you need an explicit index for that query.

These explicit indexes are automatically generated when you make a
request on the local dev server...
http://code.google.com/appengine/docs/python/config/indexconfig.html#Automatic_and_Manual_Indexes
(python)
http://code.google.com/appengine/docs/java/config/indexconfig.html#Using_Automatic_Index_Configuration
(java)

If you clear out your indexes file on a dev machine and then hit the
URL you are interested in it will automatically generate any indexes
required for that request. The contents of the index file would then
act as a rudimentary query log especially when taken next to your
Appstats from your production instance.

Grant







On Oct 7, 12:22 am, Tim Jones t...@eff.org wrote:
 I'm somewhat new to App Engine, and attempting to streamline my app's 
 datastore load.

 With a LAMP app, I'm usually able to access or generate a database query log 
 to assist in this process -- a list of all queries run on the database for a 
 given http request, along with how long each took and other helpful metadata.

 Is there a good way to access or create something similar for App Engine 
 queries? The closest I've found is Appstats -- but while Appstats will 
 provide information sorted by http-request, I haven't found a way to make it 
 display a database query log.

 Any help would be appreciated. Thanks,

 =Tim=

-- 
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-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Re: a query log?

2010-10-07 Thread Tim Jones
Thanks for the suggestion. I've already been keeping a close watch on my app's 
indexes file, and was hoping for something that would reveal more detail. 

It's true that a verbose query log isn't as important on GAE as it is on a 
relational db. Still, I bet it would be real useful for finding redundant or 
repeated queries, or just for getting a better understanding of how GAE works 
under the hood.

Maybe I'll try to hack one together...

=T=



On Oct 6, 2010, at 11:12 PM, Grant wrote:

 Hi
 
 I do not think there is a query log, but you can use the fact that the
 datastore only every queries an index to simulate one...
 
 http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html
 
 There is an implicit index on all (actually most) properties on any
 entity and those indexes are used when you query a single property on
 an entity e.g. [FROM person WHERE age = 18]
 
 To do a more complex query e.g. [FROM person WHERE country_code = 'ZA'
 AND age  18] you need an explicit index for that query.
 
 These explicit indexes are automatically generated when you make a
 request on the local dev server...
 http://code.google.com/appengine/docs/python/config/indexconfig.html#Automatic_and_Manual_Indexes
 (python)
 http://code.google.com/appengine/docs/java/config/indexconfig.html#Using_Automatic_Index_Configuration
 (java)
 
 If you clear out your indexes file on a dev machine and then hit the
 URL you are interested in it will automatically generate any indexes
 required for that request. The contents of the index file would then
 act as a rudimentary query log especially when taken next to your
 Appstats from your production instance.
 
 Grant
 
 
 
 
 
 
 
 On Oct 7, 12:22 am, Tim Jones t...@eff.org wrote:
 I'm somewhat new to App Engine, and attempting to streamline my app's 
 datastore load.
 
 With a LAMP app, I'm usually able to access or generate a database query log 
 to assist in this process -- a list of all queries run on the database for a 
 given http request, along with how long each took and other helpful metadata.
 
 Is there a good way to access or create something similar for App Engine 
 queries? The closest I've found is Appstats -- but while Appstats will 
 provide information sorted by http-request, I haven't found a way to make it 
 display a database query log.
 
 Any help would be appreciated. Thanks,
 
 =Tim=
 
 -- 
 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-appeng...@googlegroups.com.
 To unsubscribe from this group, send email to 
 google-appengine+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/google-appengine?hl=en.
 

-- 
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-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: a query log?

2010-10-07 Thread Jay Young
Try API hooks, maybe? You could set up a function to intercept
datastore queries and log them to memcache, the app log, or back into
the datastore itself.

http://code.google.com/appengine/articles/hooks.html

On Oct 7, 3:34 pm, Tim Jones t...@eff.org wrote:
 Thanks for the suggestion. I've already been keeping a close watch on my 
 app's indexes file, and was hoping for something that would reveal more 
 detail.

 It's true that a verbose query log isn't as important on GAE as it is on a 
 relational db. Still, I bet it would be real useful for finding redundant or 
 repeated queries, or just for getting a better understanding of how GAE works 
 under the hood.

 Maybe I'll try to hack one together...

 =T=

 On Oct 6, 2010, at 11:12 PM, Grant wrote:



  Hi

  I do not think there is a query log, but you can use the fact that the
  datastore only every queries an index to simulate one...

 http://code.google.com/appengine/docs/python/datastore/queriesandinde...

  There is an implicit index on all (actually most) properties on any
  entity and those indexes are used when you query a single property on
  an entity e.g. [FROM person WHERE age = 18]

  To do a more complex query e.g. [FROM person WHERE country_code = 'ZA'
  AND age  18] you need an explicit index for that query.

  These explicit indexes are automatically generated when you make a
  request on the local dev server...
 http://code.google.com/appengine/docs/python/config/indexconfig.html#...
  (python)
 http://code.google.com/appengine/docs/java/config/indexconfig.html#Us...
  (java)

  If you clear out your indexes file on a dev machine and then hit the
  URL you are interested in it will automatically generate any indexes
  required for that request. The contents of the index file would then
  act as a rudimentary query log especially when taken next to your
  Appstats from your production instance.

  Grant

  On Oct 7, 12:22 am, Tim Jones t...@eff.org wrote:
  I'm somewhat new to App Engine, and attempting to streamline my app's 
  datastore load.

  With a LAMP app, I'm usually able to access or generate a database query 
  log to assist in this process -- a list of all queries run on the database 
  for a given http request, along with how long each took and other helpful 
  metadata.

  Is there a good way to access or create something similar for App Engine 
  queries? The closest I've found is Appstats -- but while Appstats will 
  provide information sorted by http-request, I haven't found a way to make 
  it display a database query log.

  Any help would be appreciated. Thanks,

  =Tim=

  --
  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-appeng...@googlegroups.com.
  To unsubscribe from this group, send email to 
  google-appengine+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/google-appengine?hl=en.- Hide quoted text -

 - Show quoted text -

-- 
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-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: a query log?

2010-10-07 Thread Tim Hoffman
Hi

appstats does pretty much what you have asked for.  Its more about rpc
calls and time which is what a query in appengine is any way.

T

On Oct 7, 7:22 am, Tim Jones t...@eff.org wrote:
 I'm somewhat new to App Engine, and attempting to streamline my app's 
 datastore load.

 With a LAMP app, I'm usually able to access or generate a database query log 
 to assist in this process -- a list of all queries run on the database for a 
 given http request, along with how long each took and other helpful metadata.

 Is there a good way to access or create something similar for App Engine 
 queries? The closest I've found is Appstats -- but while Appstats will 
 provide information sorted by http-request, I haven't found a way to make it 
 display a database query log.

 Any help would be appreciated. Thanks,

 =Tim=

-- 
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-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.