excessive sorting of expressions
--------------------------------
Key: CORE-5814
URL: http://tracker.firebirdsql.org/browse/CORE-5814
Project: Firebird Core
Issue Type: Bug
Components: Engine
Affects Versions: 3.0.3, 2.5.7
Reporter: kdv
Grouping and sorting on expression produces additional SORT in plan.
Example.
When we group and sort on non-indexed field
select first_name, max(first_name)
from employee
group by 1
order by 1
we see PLAN SORT (EMPLOYEE NATURAL)
i.e only one sort used for grouping and sorting.
But, if we convert field to expression
select first_name||'', max(first_name)
from employee
group by 1
order by 1
plan will have 2 sorts - for group by and order by
PLAN SORT (SORT (EMPLOYEE NATURAL))
I don't know is this a real bug or engine specific, but maybe it can be fixed.
In addition. If I create computed index
create index bfc on employee computed by (first_name||'')
plan for the last query will be
PLAN SORT (EMPLOYEE ORDER BFC)
So, index is used by group by, but order by still uses additional sorting.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel