FetchOptions withLimit () does not reduce query execution time (Google App Engine)

Problem

Running a data warehouse request with or without FetchOptions.Builder.withLimit (100) takes the same run time! Why is this? Doesn't the restriction method reduce the time to get results?

Test setup

I locally check the execution time of some data warehouse queries using the Google App Engine. I am using the Google Cloud SDK Standard with the App Engine 1.9.59 SDK.

For the test, I created an example instance with 5 indexed properties and 5 non-indexed properties. I filled the repository with 50,000 test object records. I am running the following method to retrieve 100 of these objects using the withLimit () method.

public List<Long> getTestIds() {
    List<Long> ids = new ArrayList<>();
    FetchOptions fetchOptions = FetchOptions.Builder.withLimit(100);
    Query q = new Query("test_kind").setKeysOnly();
    for (Entity entity : datastore.prepare(q).asIterable(fetchOptions)) {
        ids.add(entity.getKey().getId());
    }
    return ids;
}

I measure the time before and after calling this method:

long start = System.currentTimeMillis();
int size = getTestIds().size();
long end = System.currentTimeMillis();
log.info("time: " + (end - start) + " results: " + size);

.

forLimit() FetchOptions , 50.000 1740 . .

, , withLimit (100), 100. 1740 !

. , withLimit (100) .

? , , 100 ? ? - ? 4 .

0
1
0

Source: https://habr.com/ru/post/1677417/


All Articles