Christian Tzolov created GEODE-2588:
---------------------------------------

             Summary: OQL's ORDER BY takes 13x (1300%) more time compared to 
plain java sort for the same amount of data and same resources
                 Key: GEODE-2588
                 URL: https://issues.apache.org/jira/browse/GEODE-2588
             Project: Geode
          Issue Type: Bug
          Components: querying
            Reporter: Christian Tzolov


For Partition Region with 1 500 000 entries running on a single Geode member.
The OQL query *SELECT DISTINCT a, b FROM /region ORDER BY b* takes *13x* times 
(*1300%*) more time compared to OQL *SELECT a, b FROM /region* +  manual Java 
sort of the result for the same dataset.

Setup: Geode 1.0.0 with Partition region with 1 500 000 objects, 4GB memory

1. OQL with DISTINCT/ORDER BY
{code}SELECT DISTINCT e.key,e.day FROM /partitionRegion e ORDER BY e.day{code}
OQL execution time: 64899 ms = *~65 sec*

2. OQL with manual sort
{code}SELECT e.key,e.day FROM /partitionRegion e{code}
and then
{code}
//OQL all -> 3058 ms
SelectResults result = (SelectResults) query.execute(bindings);

//Client-side sort -> 1830 ms
List<?> result2 = (List<?>) result.asList().parallelStream().sorted((o1, o2) -> 
{
    Struct st1 = (Struct) o1;
    Struct st2 = (Struct) o2;
    return ((Date) st1.get("day")).compareTo((Date) st2.get("day"));
}).collect(toList());
{code}
OQL execution time: 3058 ms,
Client-side sort time: 1830 ms
Total time: 4888 ms = *~5 sec*



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to