Current Path : /usr/opt/mysql57/mysql-test/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/r/filesort_merge.result |
CREATE TABLE t1 ( id int NOT NULL auto_increment PRIMARY KEY, b int NOT NULL, c datetime NOT NULL, INDEX idx_b(b), INDEX idx_c(c) ) ENGINE=InnoDB; CREATE TABLE t2 ( b int NOT NULL auto_increment PRIMARY KEY, c datetime NOT NULL ) ENGINE= MyISAM; INSERT INTO t2(c) VALUES ('2007-01-01'); INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t1(b,c) SELECT b,c FROM t2; UPDATE t2 SET c='2007-01-02'; INSERT INTO t1(b,c) SELECT b,c FROM t2; UPDATE t2 SET c='2007-01-03'; INSERT INTO t1(b,c) SELECT b,c FROM t2; set @@sort_buffer_size=8192; Warnings: Warning 1292 Truncated incorrect sort_buffer_size value: '8192' SELECT COUNT(*) FROM t1; COUNT(*) 3072 EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL index_merge idx_b,idx_c idx_c,idx_b 5,4 NULL # 100.00 Using sort_union(idx_c,idx_b); Using where Warnings: Note 1003 /* select#1 */ select count(0) AS `COUNT(*)` from `test`.`t1` FORCE INDEX (`idx_c`) FORCE INDEX (`idx_b`) where (((`test`.`t1`.`c` >= '2007-01-02') and (`test`.`t1`.`c` <= '2007-01-03')) or (`test`.`t1`.`b` >= 1)) SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; set optimizer_switch='semijoin=off'; set optimizer_switch='materialization=off'; CREATE TABLE t1 (topic BIGINT NOT NULL DEFAULT 0); SET @@session.sort_buffer_size=32768; SELECT * from t1 WHERE topic IN (SELECT topic FROM t1 GROUP BY topic HAVING topic < 2000) LIMIT 2 ; topic 1370 1369 SET @@session.sort_buffer_size=DEFAULT; drop table t1; set optimizer_switch=default;