polardbxengine/mysql-test/suite/secondary_engine/r/histogram.result

89 lines
5.0 KiB
Plaintext

#
# Test that histograms are used for optimizing queries that are
# offloaded to a secondary storage engine.
#
CREATE TABLE t1(id INT PRIMARY KEY, x INT NOT NULL) SECONDARY_ENGINE MOCK;
INSERT INTO t1 VALUES
(1, 1), (2, 1), (3, 1), (4, 1), (5, 1),
(6, 1), (7, 1), (8, 1), (9, 2), (10, 2);
ALTER TABLE t1 SECONDARY_LOAD;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
EXPLAIN SELECT * FROM t1 WHERE x = 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 1)
EXPLAIN SELECT * FROM t1 WHERE x = 2;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 2)
EXPLAIN SELECT * FROM t1 WHERE x = 3;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 3)
ANALYZE TABLE t1 UPDATE HISTOGRAM ON x WITH 10 BUCKETS;
Table Op Msg_type Msg_text
test.t1 histogram status Histogram statistics created for column 'x'.
EXPLAIN SELECT * FROM t1 WHERE x = 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 80.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 1)
EXPLAIN SELECT * FROM t1 WHERE x = 2;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 20.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 2)
EXPLAIN SELECT * FROM t1 WHERE x = 3;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 3)
SELECT * FROM t1 WHERE x = 1;
id x
SELECT * FROM t1 WHERE x = 2;
id x
SELECT * FROM t1 WHERE x = 3;
id x
ANALYZE TABLE t1 DROP HISTOGRAM ON x;
Table Op Msg_type Msg_text
test.t1 histogram status Histogram statistics removed for column 'x'.
EXPLAIN SELECT * FROM t1 WHERE x = 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 1)
EXPLAIN SELECT * FROM t1 WHERE x = 2;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 2)
EXPLAIN SELECT * FROM t1 WHERE x = 3;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 3)
ANALYZE TABLE t1 UPDATE HISTOGRAM ON x WITH 10 BUCKETS;
Table Op Msg_type Msg_text
test.t1 histogram status Histogram statistics created for column 'x'.
EXPLAIN SELECT * FROM t1 WHERE x = 1;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 80.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 1)
EXPLAIN SELECT * FROM t1 WHERE x = 2;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 20.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 2)
EXPLAIN SELECT * FROM t1 WHERE x = 3;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 Using where; Using secondary engine MOCK
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`x` = 3)
DROP TABLE t1;