mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-08 20:48:00 +00:00
Merge branch 'pt-tcs-where-option-using-non-optimal-index-lp1576036' of github.com:percona/percona-toolkit into pt-tcs-where-option-using-non-optimal-index-lp1576036
This commit is contained in:
@@ -6560,7 +6560,7 @@ sub _find_best_index {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$best_index && !$want_index) {
|
||||
if (!$best_index) {
|
||||
PTDEBUG && _d('Auto-selecting best index');
|
||||
foreach my $index ( $tp->sort_indexes($tbl_struct) ) {
|
||||
if ( $index eq 'PRIMARY' || $indexes->{$index}->{is_unique} ) {
|
||||
|
@@ -540,7 +540,8 @@ sub _find_best_index {
|
||||
}
|
||||
}
|
||||
|
||||
# still no best index? select amongst all candidates.
|
||||
# still no best index?
|
||||
# prefer unique index. otherwise put in candidates array.
|
||||
if (!$best_index) {
|
||||
PTDEBUG && _d('Auto-selecting best index');
|
||||
foreach my $index ( $tp->sort_indexes($tbl_struct) ) {
|
||||
@@ -554,6 +555,7 @@ sub _find_best_index {
|
||||
}
|
||||
}
|
||||
|
||||
# choose the one with best cardinality
|
||||
if ( !$best_index && @possible_indexes ) {
|
||||
PTDEBUG && _d('No PRIMARY or unique indexes;',
|
||||
'will use index with highest cardinality');
|
||||
|
Reference in New Issue
Block a user