Explain the h2 explain

classic Classic list List threaded Threaded
3 messages Options
javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Explain the h2 explain

Using 1.3.0

So I ran the following query EXPLAIN SELECT FIELD1 FROM TRX WHERE FIELD2 = ?

And got.

{"result":"[[
SELECT\n
    FIELD1 AS __C0\n
    FROM \"cache\".TRX\n

    /* \"cache\".\"FIELD2_idx\": FIELD2 = ?1 */\n

    WHERE FIELD2 = ?1], [SELECT\n
    __C0 AS FIELD1\n
    FROM \"cache\".__Z0()\n

    /* function */]]"}

So does this mean that the cache is using the index?
What is the second select?
Is this an optimal query based on the explain result?

vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Explain the h2 explain

Hi,

The first SELECT here is the execution plan for the query that is executed on remote nodes, the second one is for the local query executed during the reduce step.

Remote query execution plan shows that the index is correctly used and the query will be executed in the fastest possible way.

Since there are no aggregations in this particular query, the reduce step is trivial - result sets from remote nodes are simply merged into one. So execution plan actually doesn't show any useful information in this case.

Makes sense?

-Val
javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Re: Explain the h2 explain

Yes thank you.