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.

Reply via email to