You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Sergey Kalashnikov (JIRA)" <ji...@apache.org> on 2017/03/30 18:45:41 UTC

[jira] [Commented] (IGNITE-4524) Indexes usage in SQL functions like min/max

    [ https://issues.apache.org/jira/browse/IGNITE-4524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15949583#comment-15949583 ] 

Sergey Kalashnikov commented on IGNITE-4524:
--------------------------------------------

Found an issue in H2 while adding the tests for this one.

Here are the details:

{code}
drop table test if exists;
create table test(key int, a int, b int);
create index key_pk on test(key);
create index usr_idx on test(a, key);
explain select min(key) from test;

PLAN  
SELECT
    MIN(KEY)
FROM PUBLIC.TEST
    /* PUBLIC.USR_IDX */
/* direct lookup */
{code}

The index in "explain results" is wrong. It should be KEY_PK.


> Indexes usage in SQL functions like min/max
> -------------------------------------------
>
>                 Key: IGNITE-4524
>                 URL: https://issues.apache.org/jira/browse/IGNITE-4524
>             Project: Ignite
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Denis Magda
>            Assignee: Sergey Kalashnikov
>              Labels: important
>             Fix For: 2.0
>
>
> If to execute queries like this
> {code}
> select min(id) from MyValue
> select max(id) from MyValue
> {code}
> assuming that 'id' is an indexed field then the engine will not gain from this. 
> The SQL engine needs to be improved so that the indexes are used for queries like the ones above.
> More details can be found in this discussion:
> http://apache-ignite-developers.2346864.n4.nabble.com/min-max-SQL-and-indexes-td13492.html



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