diff options
author | Monty <monty@mariadb.org> | 2022-10-04 12:59:43 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2022-10-04 16:11:19 +0300 |
commit | a35f715f440eb9ce93e4245cb1e4e5bc6f6972a2 (patch) | |
tree | 1efc35fe4ccfa66afdd067483d9ceff74830d105 /mysql-test/main/costs.result | |
parent | a5d799298aa88d78998bc964743964abc70b84bd (diff) | |
download | mariadb-git-a35f715f440eb9ce93e4245cb1e4e5bc6f6972a2.tar.gz |
Changed aggregate distinct optimization with indexes to be cost based.
Before the cost of an aggregate distinct (COUNT(DISTINCT ...)) was set
to 0 if the values where part of an index and the cost of grouping
was higher than the best cost so far. This was shown in explain with
"Using index for group-by (scanning)".
This patch fixes it by calculating the cost of aggregate distinct
and using scanning only if the cost was better than group-by-optimization.
Thing taken into account:
- When using aggregate distinct on index, the filtering is done before
the row is checked against the WHERE and we have thus less WHERE cost.
- When comparing a cost from aggregate distinct, we add to the compared
to plan the cost of doing the filtering later in the SQL level.
Diffstat (limited to 'mysql-test/main/costs.result')
0 files changed, 0 insertions, 0 deletions