From bd0a5edd983129b46401851376a234c83f9405b7 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Fri, 23 Dec 2011 09:24:34 -0700 Subject: [PATCH] Add ts_db_tbl index to checksums table and force last chunk SQL to use it. --- bin/pt-table-checksum | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 51f8c2e8..a3fb1416 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -7168,7 +7168,7 @@ sub last_chunk { my ($dbh, $repl_table, $q) = @args{@required_args}; MKDEBUG && _d('Getting last chunk for --resume'); - my $sql = "SELECT * FROM $repl_table " + my $sql = "SELECT * FROM $repl_table FORCE INDEX (ts_db_tbl) " . "WHERE master_cnt IS NOT NULL " . "ORDER BY ts DESC, db DESC, tbl DESC LIMIT 1"; MKDEBUG && _d($sql); @@ -7924,7 +7924,7 @@ structure (MAGIC_create_replicate): master_cnt int NULL, ts timestamp NOT NULL, PRIMARY KEY (db, tbl, chunk), - INDEX (ts) + INDEX ts_db_tbl (ts, db, tbl) ) ENGINE=InnoDB; By default, L<"--[no]create-replicate-table"> is true, so the database and