We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submitted by: @ibaseru
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.
The text was updated successfully, but these errors were encountered:
assignee: Dmitry Yemanov [ dimitr ]
Sorry, something went wrong.
dyemanov
No branches or pull requests
Submitted by: @ibaseru
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.
The text was updated successfully, but these errors were encountered: