diff --git a/bin/pt-query-digest b/bin/pt-query-digest index 20a8e933..361adaf0 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -8269,7 +8269,7 @@ sub get_tables { return ($tbl); } - $query =~ s/ (?:LOW_PRIORITY|IGNORE|STRAIGHT_JOIN|DELAYED) / /ig; + $query =~ s/(?:LOW_PRIORITY|IGNORE|STRAIGHT_JOIN|DELAYED)\s+/ /ig; if ( $query =~ s/^\s*LOCK TABLES\s+//i ) { PTDEBUG && _d('Special table type: LOCK TABLES'); @@ -8282,10 +8282,15 @@ sub get_tables { $query =~ s/".*?"/?/sg; # quoted strings $query =~ s/'.*?'/?/sg; # quoted strings - if ( $query =~ m/\A\s*(?:INSERT|REPLACE)\s+(?!INTO)/i ) { + if ( $query =~ m/\A\s*(?:INSERT|REPLACE)(?!\s+INTO)/i ) { $query =~ s/\A\s*((?:INSERT|REPLACE))\s+/$1 INTO /i; } + if ( $query =~ m/\A\s*LOAD DATA/i ) { + my ($tbl) = $query =~ m/INTO TABLE\s+(\S+)/i; + return $tbl; + } + my @tables; foreach my $tbls ( $query =~ m/$tbl_regex/gio ) { PTDEBUG && _d('Match tables:', $tbls); diff --git a/t/pt-query-digest/samples/slow051.txt b/t/pt-query-digest/samples/slow051.txt index d96d69c2..983c7564 100644 --- a/t/pt-query-digest/samples/slow051.txt +++ b/t/pt-query-digest/samples/slow051.txt @@ -1,5 +1,5 @@ -# Query 1: 0.20 QPS, 0.00x concurrency, ID 0xD989521B246E945B at byte 146 +# Query 1: 0.20 QPS, 0.00x concurrency, ID 0x14354E1D979884B4 at byte 152 # This item is included in the report because it matches --limit. # Scores: V/M = 0.00 # Time range: 2007-12-18 11:48:27 to 11:48:37 @@ -10,7 +10,7 @@ # Lock time 0 0 0 0 0 0 0 0 # Rows sent 0 0 0 0 0 0 0 0 # Rows examine 0 0 0 0 0 0 0 0 -# Query size 100 86 43 43 43 43 0 43 +# Query size 100 98 49 49 49 49 0 49 # Query_time distribution # 1us # 10us ################################################################ @@ -23,9 +23,9 @@ # Tables # SHOW TABLE STATUS FROM `db` LIKE 'tbl'\G # SHOW CREATE TABLE `db`.`tbl`\G -LOAD DATA INFILE '/tmp/bar.txt' INTO db.tbl\G +LOAD DATA INFILE '/tmp/bar.txt' INTO TABLE db.tbl\G # Profile # Rank Query ID Response time Calls R/Call V/M Item -# ==== ================== ============= ===== ====== ===== ====== -# 1 0xD989521B246E945B 0.0000 100.0% 2 0.0000 0.00 db.tbl +# ==== ================== ============= ===== ====== ===== =============== +# 1 0x14354E1D979884B4 0.0000 100.0% 2 0.0000 0.00 LOAD DATA db.tbl diff --git a/t/pt-query-digest/samples/slow058.txt b/t/pt-query-digest/samples/slow058.txt index af849ff1..0022c77e 100644 --- a/t/pt-query-digest/samples/slow058.txt +++ b/t/pt-query-digest/samples/slow058.txt @@ -82,8 +82,8 @@ replace `foo` values("bar")\G # 1s # 10s+ # Tables -# SHOW TABLE STATUS FROM `db` LIKE 'table'\G -# SHOW CREATE TABLE `db`.`table`\G +# SHOW TABLE STATUS FROM `db` LIKE 'foo'\G +# SHOW CREATE TABLE `db`.`foo`\G load data local infile '/tmp/foo.txt' into table `foo`\G # Profile