Add forked Maatkit tools in bin/ and their tests in t/.

This commit is contained in:
Daniel Nichter
2011-06-24 16:02:05 -06:00
parent 6c501128e6
commit b4b6376be1
679 changed files with 177876 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
# Query ID 0xAED2E885BDADA166 at byte 0
# WARN CLA.001 SELECT without WHERE.
# WARN CLA.006 GROUP BY or ORDER BY different tables will force a temp table and filesort.
select id from tbl1 join tbl2 using (a) group by tbl1.id, tbl2.id
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0xAED2E885BDADA166 0 2 0 select id from tbl? join tbl? using (a) group by tbl?id, tbl?id

View File

@@ -0,0 +1,9 @@
# Query ID 0xBA2547D924C5140D at byte 0
# WARN CLA.007 ORDER BY different directions prevents index from being used.
select c1, c2 from t where i=1 order by c1 desc, c2 asc
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0xBA2547D924C5140D 0 1 0 select c?, c? from t where i=? order by c? desc, c?

View File

@@ -0,0 +1,35 @@
# Query ID 0xADCE32553F5D5859 at byte 0
# WARN CLA.001 SELECT without WHERE.
# NOTE COL.001 SELECT *.
select * from tbl
# Query ID 0x63C84ABE631F3CD0 at byte 191
# Also: CLA.001 COL.001
select * from tbl order by a
# Query ID 0xB79802214165F670 at byte 297
# NOTE COL.002 Blind INSERT.
insert into tbl values (null, 1, 'foo')
# Query ID 0xEEA4D551871CCDC4 at byte 414
# Also: COL.002
replace into tbl2 values (1, '2', 'bar')
# Query ID 0x52BAD5F0BF97EA19 at byte 532
# WARN RES.001 Non-deterministic GROUP BY.
select a, b, c from x where id<1000 group by a, b
# Query ID 0x01BF72F436E936F1 at byte 659
# Also: RES.001
select x, y, z from foo where id>1000 group by x, y
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0x01BF72F436E936F1 0 1 0 select x, y, z from foo where id>? group by x, y
# 0x52BAD5F0BF97EA19 0 1 0 select a, b, c from x where id<? group by a, b
# 0x63C84ABE631F3CD0 1 1 0 select * from tbl order by a
# 0xADCE32553F5D5859 1 1 0 select * from tbl
# 0xB79802214165F670 1 0 0 insert into tbl values(?+)
# 0xEEA4D551871CCDC4 1 0 0 replace into tbl? values(?+)

View File

@@ -0,0 +1,22 @@
0x01BF72F436E936F1 RES.001
0x52BAD5F0BF97EA19 RES.001
0x63C84ABE631F3CD0 CLA.001 COL.001
0xADCE32553F5D5859 CLA.001 COL.001
0xB79802214165F670 COL.002
0xEEA4D551871CCDC4 COL.002
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0x01BF72F436E936F1 0 1 0 select x, y, z from foo where id>? group by x, y
# 0x52BAD5F0BF97EA19 0 1 0 select a, b, c from x where id<? group by a, b
# 0x63C84ABE631F3CD0 1 1 0 select * from tbl order by a
# 0xADCE32553F5D5859 1 1 0 select * from tbl
# 0xB79802214165F670 1 0 0 insert into tbl values(?+)
# 0xEEA4D551871CCDC4 1 0 0 replace into tbl? values(?+)

View File

@@ -0,0 +1,18 @@
CLA.001 0x63C84ABE631F3CD0 0xADCE32553F5D5859
COL.001 0x63C84ABE631F3CD0 0xADCE32553F5D5859
COL.002 0xB79802214165F670 0xEEA4D551871CCDC4
RES.001 0x01BF72F436E936F1 0x52BAD5F0BF97EA19
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0x01BF72F436E936F1 0 1 0 select x, y, z from foo where id>? group by x, y
# 0x52BAD5F0BF97EA19 0 1 0 select a, b, c from x where id<? group by a, b
# 0x63C84ABE631F3CD0 1 1 0 select * from tbl order by a
# 0xADCE32553F5D5859 1 1 0 select * from tbl
# 0xB79802214165F670 1 0 0 insert into tbl values(?+)
# 0xEEA4D551871CCDC4 1 0 0 replace into tbl? values(?+)

View File

@@ -0,0 +1,11 @@
use test;
create table L (
l_id int not null primary key
);
insert into L(l_id) values(1),(2),(3);
create table R (
r_id int not null primary key,
r_other int NULL -- notice that this is NULL-able
);
insert into R(r_id, r_other) values(1, 5), (2, NULL);

View File

@@ -0,0 +1,22 @@
# Query ID 0x95718954DB8B7620 at byte 0
# NOTE COL.001 SELECT *.
# CRIT JOI.001 Mixing comma and ANSI joins.
# CRIT JOI.002 A table is joined twice.
SELECT * FROM `wibble_chapter`
INNER JOIN `wibble_series` AS `wibble_chapter__series`
ON `wibble_chapter`.`series_id` = `wibble_chapter__series`.`id`,
`wibble_series`,
`auth_user`
WHERE ( `wibble_chapter`.`chapnum` = 63.0
AND `wibble_chapter`.`status` = 1
AND `wibble_chapter__series`.`title` = 'bibble' )
AND `wibble_chapter`.`series_id` = `wibble_series`.`id`
AND `wibble_series`.`poster_id` = `auth_user`.`id`
ORDER BY `wibble_chapter`.`create_time` DESC
LIMIT 1
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0x95718954DB8B7620 1 0 2 select * from `wibble_chapter` inner join `wibble_series` as `wibble_chapter__series` on `wibble_chapter`.`series_id` = `wibble_chapter__series`.`id`, `wibble_series`, `auth_user` where ( `wibble_chapter`.`chapnum` = ? and `wibble_chapter`.`status` = ? and `wibble_chapter__series`.`title` = ? ) and `wibble_chapter`.`series_id` = `wibble_series`.`id` and `wibble_series`.`poster_id` = `auth_user`.`id` order by `wibble_chapter`.`create_time` desc limit ?

View File

@@ -0,0 +1,10 @@
# Query ID 0xDFCCE9A43086FAFB at byte 0
# WARN LIT.001 Storing an IP address as characters.
# matches near: p="127.0.0.1"
SELECT ip FROM tbl WHERE ip="127.0.0.1"
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== =============================
# 0xDFCCE9A43086FAFB 0 1 0 select ip from tbl where ip=?

View File

@@ -0,0 +1,10 @@
# Query ID 0x0C74A51C7CA7AA15 at byte 0
# WARN LIT.002 Unquoted date/time literal.
# matches near: < 2010-02-15
SELECT c FROM tbl WHERE c < 2010-02-15
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== =============================
# 0x0C74A51C7CA7AA15 0 1 0 select c from tbl where c < ?

View File

@@ -0,0 +1,8 @@
# Query ID 0xE6F50A59C746B888 at byte 0
SELECT c FROM tbl WHERE c=20100215
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ===========================
# 0xE6F50A59C746B888 0 0 0 select c from tbl where c=?

View File

@@ -0,0 +1,9 @@
# Query ID 0xD2BA209E593ABAA7 at byte 0
# NOTE COL.002 Blind INSERT.
insert into foo values ("bar")
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================
# 0xD2BA209E593ABAA7 1 0 0 insert into foo values(?+)

View File

@@ -0,0 +1,9 @@
# Query ID 0x9DEC61FB7711A48B at byte 0
# NOTE COL.002 Blind INSERT.
replace into foo values ("bar")
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ===========================
# 0x9DEC61FB7711A48B 1 0 0 replace into foo values(?+)

View File

@@ -0,0 +1,9 @@
# Query ID 0x3ABB67240C860825 at byte 0
# NOTE COL.001 SELECT *.
select * from tbl where id=42 order by col
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== =========================================
# 0x3ABB67240C860825 1 0 0 select * from tbl where id=? order by col

View File

@@ -0,0 +1,13 @@
# Query ID 0x3ABB67240C860825 at byte 0
# NOTE COL.001 SELECT *.
select * from tbl where id=42 order by col
# Query ID 0xE6CB49B8022C078D at byte 0
select col from tbl2 where id=52 order by col limit 10
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0x3ABB67240C860825 1 0 0 select * from tbl where id=? order by col
# 0xE6CB49B8022C078D 0 0 0 select col from tbl? where id=? order by col limit ?

View File

@@ -0,0 +1,14 @@
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
select * from tbl;
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
select * from tbl;
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
select * from tbl order by a;
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
insert into tbl values (null, 1, 'foo');
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
replace into tbl2 values (1, '2', 'bar');
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
select a, b, c from x where id<1000 group by a, b;
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
select x, y, z from foo where id>1000 group by x, y;

View File

@@ -0,0 +1,10 @@
# Query ID 0xD6E9D91F645455DB at byte 0
# CRIT SUB.001 IN() and NOT IN() subqueries are poorly optimized.
# matches near: i in (select * from j)
select t from w where i=1 or i in (select * from j)
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0xD6E9D91F645455DB 0 0 1 select t from w where i=? or i in (select * from j)

View File

@@ -0,0 +1,8 @@
# Query ID 0xE182E0865F5BEEBB at byte 0
SELECT * FROM tbl WHERE id=1
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ============================
# 0xE182E0865F5BEEBB 0 0 0 select * from tbl where id=?

View File

@@ -0,0 +1,9 @@
# Query ID 0xE182E0865F5BEEBB at byte 0
# NOTE COL.001 SELECT *.
SELECT * FROM tbl WHERE id=1
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ============================
# 0xE182E0865F5BEEBB 1 0 0 select * from tbl where id=?

View File

@@ -0,0 +1,9 @@
# Query ID 0x34C93ACCCD015F48 at byte 0
# NOTE COL.001 SELECT *.
SELECT tbl.* FROM tbl WHERE id=2
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ================================
# 0x34C93ACCCD015F48 1 0 0 select tbl.* from tbl where id=?

View File

@@ -0,0 +1,11 @@
# Query ID 0x75364D6054FA40ED at byte 0
# NOTE ALI.001 Aliasing without the AS keyword.
# WARN ALI.002 Aliasing the '*' wildcard.
# NOTE COL.001 SELECT *.
SELECT tbl.* foo, bar FROM tbl WHERE id=1
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== =========================================
# 0x75364D6054FA40ED 2 1 0 select tbl.* foo, bar from tbl where id=?

View File

@@ -0,0 +1,10 @@
# Query ID 0x31C7ABF526209286 at byte 0
# WARN ALI.002 Aliasing the '*' wildcard.
# NOTE COL.001 SELECT *.
SELECT tbl.* AS foo, bar FROM tbl WHERE id=2
# Profile
# Query ID NOTE WARN CRIT Item
# ================== ==== ==== ==== ==========================================
# 0x31C7ABF526209286 1 1 0 select tbl.* as foo, bar from tbl where id=?