ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valentin Kulichenko <valentin.kuliche...@gmail.com>
Subject min()/max() SQL and indexes
Date Tue, 03 Jan 2017 19:59:09 GMT
Folks,

Does anyone know if index is supposed to be used when a query like below is
executed?

select min(id) from MyValue
select max(id) from MyValue

I tried it and execution time doesn't seem to depend on whether I create an
index for 'id' field or not. It always takes around 2 seconds with only
5,000,000 records on a single node. Result is the same for min() and max(),
so index order doesn't seem to have affect either.

Execution plan shows that index is used though:

SELECT
    MAX(ID) AS __C0
FROM "test".MYVALUE
    /* "test"."id_idx" */

SELECT
    MAX(__C0) AS __C0
FROM PUBLIC.__T0
    /* "test"."merge_scan" */

Sergi, can you please clarify what is the expected behavior here?

-Val

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message