Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8404809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:41:40+00:00 2026-06-09T22:41:40+00:00

Im running a query and it is currently returning 1400 results and because of

  • 0

Im running a query and it is currently returning 1400 results and because of this I am getting the following warning in the log file:

com.google.appengine.api.datastore.QueryResultsSourceImpl
logChunkSizeWarning: This query does not have a chunk size set in
FetchOptions and has returned over 1000 results. If result sets of
this size are common for this query, consider setting a chunk size to
improve performance.

I can’t find any examples anywhere as to how to actually implement this, there is a question on here about python, but as Im using java and dont understand python, I am struggling to translate it.

Also this query (below) is taking 17226cpu_ms to execute, which feels like way too long, I cant even imagine what would happen if I had say 5000 contacts and needed to search through them on the client side (like you do with googlemail contacts!)

The code I have is:

    int index=0;
    int numcontacts=0;
    String[][] DetailList;

    PersistenceManager pm = PMF.get().getPersistenceManager();


    try {
        Query query = pm.newQuery(Contact.class, "AdminID == AID");
        query.declareParameters("Long AID");
        query.setOrdering("Name asc");
        List<Contact> Contacts = (List<Contact>) query.execute(AdminID);
        numcontacts=Contacts.size();
        DetailList=new String[numcontacts][5];

        for (Contact contact : Contacts) 
        {
            DetailList[index][0]=contact.getID().toString();
            DetailList[index][1]=Encode.EncodeString(contact.getName());
            index++;
        }
    } finally {
        pm.close();
    }
    return (DetailList);

I found the following two entries on here:

  • google app engine chunkSize & prefetchSize – where can I read details on it?
  • GAE/J Low-level API: FetchOptions usage

but neither actually goes into any details about how to implement or use these options.
Im guessing its a server side process, and Im guessing that you are meant to setup some kind of loop to grab the chunks one chunk at a time, but how do I actually do that?

  • Do I call the query inside a loop?
  • How do I know how many times to loop?
  • Do I just check for the first chunk that comes back with less than the chunk size number of entries?

How am I meant to go about finding out stuff like this without an actual example to follow?
It seems to me that other people on here seem to “just know” how to do it..!

Sorry If I am not asking the questions in the right way or I’m just being a dim newbie about this, but I dont know where else to turn to figure this out!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:41:42+00:00Added an answer on June 9, 2026 at 10:41 pm

    Meeting the same problem and the last comment was from a month ago, so here is what I found out about heavy dataset query.

    I guess I’m gonna use the “Query cursor” technique after reading those lines in the google docs article (the one in python mentioned by the way) :

    This article was written for SDK version 1.1.7. As of release 1.3.1,
    query cursors (Java | Python) have superseded the techniques described
    below and are now the recommended method for paging through large
    datasets.

    In the google docs about “Query Cursor“.
    The first line of the doc gives precisely why the need for cursor :

    Query cursors allow an app to perform a query and retrieve a batch of
    results, then fetch additional results for the same query in a
    subsequent web request without the overhead of a query offset.

    The documentation provides also a java example of a servlet using the cursor technique. There is a tip how to generate a safe cursor for the client. Finally, limitations of cursor are exposed.

    Hope this gives you a lead to resolve your problem.

    Small reminder about range and offset, quite impacting on performance if forgotten (and I did^^) :

    The starting offset has implications for performance: the Datastore
    must retrieve and then discard all results prior to the starting
    offset. For example, a query with a range of 5, 10 fetches ten results
    from the Datastore, then discards the first five and returns the
    remaining five to the application.


    Edit : As working with JDO, I kept looking for a way to allow my previous code to load more than 1000 result in a single query. So, if you’re using JDO too, I found this old issue:

    Query query = pm.newQuery(...);
    // I would use of value below 1000 (gae limit) 
    query.getFetchPlan().setFetchSize(numberOfRecordByFetch); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently running the following query: SELECT * from people WHERE id = 4;
Currently I'm running a MySQL query like this $query = SELECT t1.id AS 'post_id',
I'm currently running a query like this: SELECT * FROM email WHERE email_address LIKE
Evening, I'm currently running this query: SELECT `id`, `type`, `controller` FROM `urls` WHERE `url`
Running this query takes a long time: SELECT host,ip FROM arecords WHERE ip IN
After running this query statement with my database: select * from articles where content
Im running this query on the same server as the web application, so SPQuery.ExpandRecurrence
I'm running a query which looks like this SELECT parent.field, child.field FROM parent JOIN
I am running this query SELECT sh.*, u.initials AS initals FROM database1.table1 AS sh
Currently, I have a log file of messages in one table in a MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.