mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
Add --chunk-index-columns to pt-osc.
This commit is contained in:
@@ -1893,6 +1893,7 @@ sub generate_asc_stmt {
|
||||
@asc_cols = $asc_cols[0];
|
||||
}
|
||||
elsif ( my $n = $args{n_index_cols} ) {
|
||||
$n = scalar @asc_cols if $n > @asc_cols;
|
||||
PTDEBUG && _d('Ascending only first', $n, 'columns');
|
||||
@asc_cols = @asc_cols[0..($n-1)];
|
||||
}
|
||||
@@ -5209,14 +5210,8 @@ sub main {
|
||||
}
|
||||
}
|
||||
|
||||
# Parse --chunk-index INDEX:N where N is the number of
|
||||
# left-most columns of INDEX to use.
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1010232
|
||||
my ($chunk_index, $n_chunk_index_cols)
|
||||
= split(':', $o->get('chunk-index') || '');
|
||||
if ( defined $chunk_index && $chunk_index eq '' ) {
|
||||
$o->save_error('--chunk-index cannot be an empty string');
|
||||
}
|
||||
my $n_chunk_index_cols = $o->get('chunk-index-columns');
|
||||
if ( defined $n_chunk_index_cols
|
||||
&& (!$n_chunk_index_cols
|
||||
|| $n_chunk_index_cols =~ m/\D/
|
||||
@@ -6108,8 +6103,8 @@ sub main {
|
||||
Cxn => $cxn,
|
||||
tbl => $orig_tbl,
|
||||
chunk_size => $orig_tbl->{chunk_size},
|
||||
chunk_index => $chunk_index,
|
||||
n_chunk_index_cols => $n_chunk_index_cols,
|
||||
chunk_index => $o->get('chunk-index'),
|
||||
n_chunk_index_cols => $o->get('chunk-index-columns'),
|
||||
dml => $dml,
|
||||
select => $select,
|
||||
callbacks => $callbacks,
|
||||
@@ -7453,16 +7448,18 @@ behavior of choosing an index. The tool adds the index to the SQL statements in
|
||||
a C<FORCE INDEX> clause. Be careful when using this option; a poor choice of
|
||||
index could cause bad performance.
|
||||
|
||||
This option supports a special syntax to select a prefix of the index instead of
|
||||
the entire index. The syntax is NAME:N, where NAME is the name of the index, and
|
||||
N is the number of columns you wish to use. This works only for compound
|
||||
indexes, and is useful in cases where a bug in the MySQL query optimizer
|
||||
(planner) causes it to scan a large range of rows instead of using the index to
|
||||
locate starting and ending points precisely. This problem sometimes occurs on
|
||||
indexes with many columns, such as 4 or more. If this happens, the tool might
|
||||
print a warning related to the L<"--[no]check-plan"> option. Instructing
|
||||
the tool to use only the first N columns from the index is a workaround for
|
||||
the bug in some cases.
|
||||
=item --chunk-index-columns
|
||||
|
||||
type: int
|
||||
|
||||
Use only this many left-most columns of a L<"--chunk-index">. This works
|
||||
only for compound indexes, and is useful in cases where a bug in the MySQL
|
||||
query optimizer (planner) causes it to scan a large range of rows instead
|
||||
of using the index to locate starting and ending points precisely. This
|
||||
problem sometimes occurs on indexes with many columns, such as 4 or more.
|
||||
If this happens, the tool might print a warning related to the
|
||||
L<"--[no]check-plan"> option. Instructing the tool to use only the first
|
||||
N columns of the index is a workaround for the bug in some cases.
|
||||
|
||||
=item --chunk-size
|
||||
|
||||
|
@@ -6171,8 +6171,6 @@ sub main {
|
||||
}
|
||||
}
|
||||
|
||||
# Parse --chunk-index INDEX:N where N is the number of
|
||||
# left-most columns of INDEX to use.
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1010232
|
||||
my $n_chunk_index_cols = $o->get('chunk-index-columns');
|
||||
if ( defined $n_chunk_index_cols
|
||||
|
Reference in New Issue
Block a user