You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Hans Zeller (JIRA)" <ji...@apache.org> on 2015/12/11 00:28:11 UTC

[jira] [Resolved] (TRAFODION-1695) Query with ORDER BY on divisioned table should avoid a sort if matching key column exists

     [ https://issues.apache.org/jira/browse/TRAFODION-1695?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hans Zeller resolved TRAFODION-1695.
------------------------------------
    Resolution: Fixed

Committed as part of https://github.com/apache/incubator-trafodion/pull/218.

> Query with ORDER BY on divisioned table should avoid a sort if matching key column exists
> -----------------------------------------------------------------------------------------
>
>                 Key: TRAFODION-1695
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-1695
>             Project: Apache Trafodion
>          Issue Type: New Feature
>          Components: sql-cmp
>         Environment: Any
>            Reporter: Hans Zeller
>            Assignee: Hans Zeller
>
> The problem seems to be specific to a divisioned table, when we query a single division. In that case, we should be able to match the order of the other key columns.
> Test case:
> drop table tddesc;
> create table tddesc(company_id int not null,
>                     sub_id int not null,
>                     ts timestamp not null,
>              a int,
>              primary key (company_id, sub_id, ts desc))
> division by (date_part('yearmonth', ts) desc);
> insert into tddesc values (1,1,current_timestamp, 1);
> insert into tddesc values (2,2,current_timestamp, 2);
> insert into tddesc values (9,9,current_timestamp + interval '31' day, 9);
> explain 
> -- display
> select [first 10] * from tddesc
> where company_id = 2 and sub_id = 2 and ts between timestamp '2015-01-01 10:00:00.0000' and timestamp '2015-01-01 11:00:00.0000'
> order by ts desc;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)