This shouldn't take that long to run. Can you post any other code or
benchmarking code?

On Sun, Mar 7, 2010 at 6:33 PM, Karel Alvarez <[email protected]> wrote:
> Hi guy,
> I hate to bother everybody again.
> I have a ver simple class, some fields, and an String primary key. One
> of the fields "lastTimeIndexed" is a date.
> I am trying to get the max value for it, the folowing method working
> fine upto 3k records, but now I added more, and it takes minutes to
> run.
> I have the autoGenerate flag set to true in the datastore-indexes.xml,
> and also the datastore-indexes-auto.xml file...
> here is the code, what is wrong with it?? can anybody think of a
> better way of doing this??
>
> public Date getLastDate() {
>                Date lastDate = null;
>                PersistenceManager pm = getPersistenceManager();
>                Query query = pm.newQuery(IndexEntry.class);
>                query.setOrdering("lastTimeIndexed desc");
>                query.setRange(0, 1);
>                query.setUnique(true);
>                try {
>                        IndexEntry entries = (IndexEntry) query.execute();
>                        if (entries != null) {
>                                lastDate = entries.getLastTimeIndexed();
>                        }
>                } finally {
>                        query.closeAll();
>                }
>                return lastDate;
>        }
>
> thanks
> Karel
>
> --
> 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 [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-java?hl=en.
>
>



-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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 [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-java?hl=en.

Reply via email to