mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-24 02:01:42 +08:00
PT-1757 Implemented fallback in NibbleIterator
Since now NibbleIterator can fallback to nibble (from one chunk) pt-osc can nibble tables even if due to unacurate stats, it choses one nible as the initial nibbling method.
This commit is contained in:
@@ -151,8 +151,8 @@ sub _make_range_query {
|
||||
# we don't want the last column; that's added below.
|
||||
foreach my $n ( 0..($n_index_cols - 2) ) {
|
||||
my $col = $index_cols->[$n];
|
||||
my $val = $vals->[$n];
|
||||
push @where, $q->quote($col) . " = ?";
|
||||
my $val = $tbl->{tbl_struct}->{type_for}->{$col} eq 'enum' ? "CAST(? AS UNSIGNED)" : "?";
|
||||
push @where, $q->quote($col) . " = " . $val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,8 @@ sub _make_range_query {
|
||||
# the N left-most index columns.
|
||||
my $col = $index_cols->[$n_index_cols - 1];
|
||||
my $val = $vals->[-1]; # should only be as many vals as cols
|
||||
push @where, $q->quote($col) . " >= ?";
|
||||
my $condition = $tbl->{tbl_struct}->{type_for}->{$col} eq 'enum' ? "CAST(? AS UNSIGNED)" : "?";
|
||||
push @where, $q->quote($col) . " >= " . $condition;
|
||||
|
||||
my $sql = "EXPLAIN SELECT /*!40001 SQL_NO_CACHE */ * "
|
||||
. "FROM $tbl->{name} FORCE INDEX (" . $q->quote($index) . ") "
|
||||
|
||||
Reference in New Issue
Block a user