Hi oqhost,

You have your 'k' and 'a' arguments backwards - the 'k' queries are
returning the full entities, while the 'a' queries are only returning
keys!

-Nick Johnson

On Thu, May 14, 2009 at 5:52 PM, oqhost <[email protected]> wrote:
>
> I have model:
>
> class Artist1(db.Model):
>  album_id = db.IntegerProperty()
>  artist_id = db.IntegerProperty()
>  genre_id = db.IntegerProperty()
>  name = db.StringProperty()
>  price = db.FloatProperty()
>  year = db.IntegerProperty()
>
>
> Simple code for fetching:
>
> def get(self):
>  num = int(self.request.get('num'))
>  key = str(self.request.get('key'))
>
>  if (key == "k"):
>    q = db.GqlQuery('select * from Artist1')
>  if (key == "a"):
>    q = db.GqlQuery('select __key__ from Artist1')
>
>  r = q.fetch(num)
>
> I have abnormal cpu results in admin logs: (a=query all, k=query key;
> 10,50,etc=fetch limit)
>
> a10
> 973ms 97cpu_ms 30api_cpu_ms
> 684ms 99cpu_ms 30api_cpu_ms
> 569ms 60cpu_ms 30api_cpu_ms
>
> k10
> 325ms 240cpu_ms 150api_cpu_ms
> 278ms 282cpu_ms 150api_cpu_ms
> 434ms 175cpu_ms 150api_cpu_ms
>
> a50
> 615ms 163cpu_ms 78api_cpu_ms
> 810ms 177cpu_ms 78api_cpu_ms
> 672ms 100cpu_ms 78api_cpu_ms
>
> k50
> 678ms 778cpu_ms 678api_cpu_ms
> 592ms 764cpu_ms 678api_cpu_ms
> 543ms 757cpu_ms 678api_cpu_ms
>
> a100
> 344ms 188cpu_ms 138api_cpu_ms
> 415ms 184cpu_ms 138api_cpu_ms
> 537ms 163cpu_ms 138api_cpu_ms
>
> k100
> 370ms 1496cpu_ms 1338api_cpu_ms
> 298ms 1496cpu_ms 1338api_cpu_ms
> 392ms 1470cpu_ms 1338api_cpu_ms
>
> a250
> 314ms 385cpu_ms 318api_cpu_ms
> 661ms 382cpu_ms 318api_cpu_ms
> 281ms 376cpu_ms 318api_cpu_ms
>
> k250
> 967ms 3872cpu_ms 3318api_cpu_ms
> 751ms 3714cpu_ms 3318api_cpu_ms
> 819ms 3687cpu_ms 3318api_cpu_ms
>
> Question: why "select __key__" costs in 5-10 times more, than "select
> *" and can we expect that this "fix", cos i suppose opposite situation
> (less time for query then more)?
>
> My AppID: fetch0
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to