diff options
author | Monty <monty@mariadb.org> | 2021-10-08 02:36:58 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2023-02-02 20:25:25 +0300 |
commit | 6fa7451759e0832cc13a0e47a8300292b96bdb75 (patch) | |
tree | 5aeea780d19da98e9fc17f1681cce821d834bf89 /mysql-test/suite/vcol | |
parent | bc9805e95432325b8d3d812e7cc4f6e1380d2345 (diff) | |
download | mariadb-git-6fa7451759e0832cc13a0e47a8300292b96bdb75.tar.gz |
Adjust costs for doing index scan in cost_group_min_max()
The idea is that when doing a tree dive (once per group), we need to
compare key values, which is fast. For each new group, we have to
compare the full where clause for the row.
Compared to original code, the cost of group_min_max() has slightly
increased which affects some test with only a few rows.
main.group_min_max and main.distinct have been modified to show the
effect of the change.
The patch also adjust the number of groups in case of quick selects:
- For simple WHERE clauses, ensure that we have at least as many groups
as we have conditions on the used group-by key parts.
The assumption is that each condition will create at least one group.
- Ensure that there are no more groups than rows found by quick_select
Test changes:
- For some small tables there has been a change of
Using index for group-by -> Using index for group-by (scanning)
Range -> Index and Using index for group-by -> Using index
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_select_innodb.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_select_myisam.result | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_select_innodb.result b/mysql-test/suite/vcol/r/vcol_select_innodb.result index 57a17cbe468..0f1e1df2928 100644 --- a/mysql-test/suite/vcol/r/vcol_select_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_select_innodb.result @@ -135,7 +135,7 @@ count(distinct c) 3 explain select count(distinct c) from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL c 5 NULL 5 Using index for group-by +1 SIMPLE t1 range NULL c 5 NULL 5 Using index for group-by (scanning) ### ### filesort & range-based utils ### diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result index d8271252137..301c9defb6d 100644 --- a/mysql-test/suite/vcol/r/vcol_select_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result @@ -133,7 +133,7 @@ count(distinct c) 3 explain select count(distinct c) from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL c 5 NULL 5 Using index for group-by +1 SIMPLE t1 range NULL c 5 NULL 5 Using index for group-by (scanning) ### ### filesort & range-based utils ### |