I am also getting and closing a new PersistenceManager around the
query, if that matters

On Feb 9, 11:08 pm, Brian <bwa...@gmail.com> wrote:
>  Hi guys,
>
> I was wondering if anyone has found a less CPU intensive way to query.
> I basically have a bunch of small objects in the database I want out.
> I tried a few ways to get them out, including an extent and a query. I
> ended up settling on this:
>
>                         Query query = pm.newQuery(Post.class);
>                         query.setOrdering("postedDate desc");
>                         query.setRange(start, end);
>                         List<Post> posts = (List<Post>) query.execute();
>
> Doing a range of 0 to 1000.. figuring the 1000 newest items is good
> enough.
>
> I find that this tends to be pretty bad on my quota CPU.. like maybe 8
> seconds of CPU time per query, if there are 1000 posts. Is this just
> how it is? Or do I need to add an index to postedDate maybe?
>
> I plan to play with it more tomorow, but if anyone has insight on
> getting stuff out of the database fast (from both a time and CPU quota
> standpoint), I would appreciate it. I have never seen a datbase take> .1 
> seconds for such a stupid silly query, I have to be doing
>
> something wrong.
>
> 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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to