SHOW TABLE STATUS is used needlessly
Bug #960513 reported by
Baron Schwartz
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Daniel Nichter | ||
2.0 |
Won't Fix
|
Undecided
|
Unassigned | ||
2.1 |
Fix Released
|
High
|
Daniel Nichter |
Bug Description
In SchemaIterator:
while ( my $tbl = shift @{$self->{tbls}} ) {
my $tbl_status;
if ( $self->
|| $self->
|| $self->
{
my $sql = "SHOW TABLE STATUS FROM " . $q->quote(
. " LIKE \'$tbl\'";
We should not get the engine from SHOW TABLE STATUS, but from SHOW CREATE TABLE. This is a potentially serious performance impact on the database server.
Related branches
lp:~percona-toolkit-dev/percona-toolkit/fix-table-status-bug-960513
Rejected
for merging
into
lp:percona-toolkit/2.0
- Daniel Nichter: Approve
-
Diff: 15458 lines (+13654/-776)41 files modifiedbin/pt-duplicate-key-checker (+171/-92)
bin/pt-fingerprint (+2143/-0)
bin/pt-index-usage (+170/-92)
bin/pt-table-checksum (+42/-67)
bin/pt-table-sync (+553/-404)
bin/pt-table-usage (+7320/-0)
lib/NibbleIterator.pm (+8/-15)
lib/QueryRewriter.pm (+24/-4)
lib/SQLParser.pm (+98/-8)
lib/SchemaIterator.pm (+27/-45)
lib/TableUsage.pm (+1060/-0)
t/lib/QueryRewriter.t (+59/-1)
t/lib/SchemaIterator.t (+2/-47)
t/lib/TableUsage.t (+817/-0)
t/lib/samples/SchemaIterator/all-dbs-tbls.txt (+486/-0)
t/lib/samples/SchemaIterator/resume-from-ignored-sakila-payment.txt (+49/-0)
t/lib/samples/SchemaIterator/resume-from-sakila-payment.txt (+66/-0)
t/pt-fingerprint/basics.t (+101/-0)
t/pt-fingerprint/samples/query001 (+2/-0)
t/pt-fingerprint/samples/query001.fingerprint (+1/-0)
t/pt-fingerprint/samples/query002 (+2/-0)
t/pt-fingerprint/samples/query002.fingerprint (+1/-0)
t/pt-table-sync/issue_408.t (+1/-1)
t/pt-table-usage/basics.t (+138/-0)
t/pt-table-usage/create_table_definitions.t (+41/-0)
t/pt-table-usage/explain_extended.t (+79/-0)
t/pt-table-usage/samples/ee.out (+6/-0)
t/pt-table-usage/samples/ee.sql (+26/-0)
t/pt-table-usage/samples/in/slow001.txt (+24/-0)
t/pt-table-usage/samples/in/slow002.txt (+20/-0)
t/pt-table-usage/samples/in/slow003.txt (+3/-0)
t/pt-table-usage/samples/out/create-table-defs-001.txt (+4/-0)
t/pt-table-usage/samples/out/create001.txt (+5/-0)
t/pt-table-usage/samples/out/drop-table-if-exists.txt (+3/-0)
t/pt-table-usage/samples/out/query001.txt (+6/-0)
t/pt-table-usage/samples/out/query002.txt (+5/-0)
t/pt-table-usage/samples/out/slow001.txt (+31/-0)
t/pt-table-usage/samples/out/slow002.txt (+40/-0)
t/pt-table-usage/samples/out/slow003-001.txt (+6/-0)
t/pt-table-usage/samples/out/slow003-002.txt (+8/-0)
t/pt-table-usage/samples/out/slow003-003.txt (+6/-0)
- Baron Schwartz (community): Approve
- Daniel Nichter: Approve
-
Diff: 3105 lines (+1575/-763)11 files modifiedbin/pt-duplicate-key-checker (+171/-92)
bin/pt-index-usage (+170/-92)
bin/pt-table-checksum (+42/-67)
bin/pt-table-sync (+553/-404)
lib/NibbleIterator.pm (+8/-15)
lib/SchemaIterator.pm (+27/-45)
t/lib/SchemaIterator.t (+2/-47)
t/lib/samples/SchemaIterator/all-dbs-tbls.txt (+486/-0)
t/lib/samples/SchemaIterator/resume-from-ignored-sakila-payment.txt (+49/-0)
t/lib/samples/SchemaIterator/resume-from-sakila-payment.txt (+66/-0)
t/pt-table-sync/issue_408.t (+1/-1)
tags: | added: performance schema-iter |
To post a comment you must log in.
pt-table-sync 2.0+ is using an old version of SchemaIterator. I think this is because I didn't want to mess with the tool's internals. But I'm going to update it now because I can see how to make the most minimal changes. Then I'll update SchemaIterator to avoid SHOW TABLE STATUS, update the module in all tools, and everything should continue to work.