mysql5/mysql-5.7.27/mysql-test/suite/parts/r/partition_icp.result

142 lines
4.6 KiB
Plaintext

#
# test using Index Condition Pushdown for partitioned tables
#
# Test failure of ICP calls -> don't use ICP (MyISAM does not support
# ICP on BLOB indexes)
CREATE TABLE t1 (a int PRIMARY KEY, b BLOB, c varchar(16) DEFAULT 'Filler...', INDEX (b(4), a))
ENGINE = MyISAM
PARTITION BY HASH (a) PARTITIONS 3;
Warnings:
Warning 1287 The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` blob,
`c` varchar(16) DEFAULT 'Filler...',
PRIMARY KEY (`a`),
KEY `b` (`b`(4),`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
PARTITIONS 3 */
Warnings:
Warning 1287 The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
INSERT INTO t1 (a, b) VALUES (1, 0xdeadbeef), (2, "text filler"),
(3, 'filler...'), (4, " more filler "), (5, "test text"), (6, "testing...");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t1 analyze warning The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
EXPLAIN SELECT a, HEX(b) FROM t1 WHERE b >= 'te' and (a % 2);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 p0,p1,p2 range b b 7 NULL 6 100.00 Using where
Warnings:
Warning 1287 The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`b`) AS `HEX(b)` from `test`.`t1` where ((`test`.`t1`.`b` >= 'te') and (`test`.`t1`.`a` % 2))
EXPLAIN FORMAT=JSON SELECT a, HEX(b) FROM t1 WHERE b >= 'te' and (a % 2);
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "9.41"
},
"table": {
"table_name": "t1",
"partitions": [
"p0",
"p1",
"p2"
],
"access_type": "range",
"possible_keys": [
"b"
],
"key": "b",
"used_key_parts": [
"b"
],
"key_length": "7",
"rows_examined_per_scan": 6,
"rows_produced_per_join": 6,
"filtered": "100.00",
"cost_info": {
"read_cost": "8.21",
"eval_cost": "1.20",
"prefix_cost": "9.41",
"data_read_per_join": "240"
},
"used_columns": [
"a",
"b"
],
"attached_condition": "((`test`.`t1`.`b` >= 'te') and (`test`.`t1`.`a` % 2))"
}
}
}
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`b`) AS `HEX(b)` from `test`.`t1` where ((`test`.`t1`.`b` >= 'te') and (`test`.`t1`.`a` % 2))
SELECT a, HEX(b) FROM t1 WHERE b >= 'te' and (a % 2);
a HEX(b)
1 DEADBEEF
5 746573742074657874
Only MyISAM and InnoDB supports both INDEX and BLOBS...
ALTER TABLE t1 ENGINE = InnoDB;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
EXPLAIN SELECT a, HEX(b) FROM t1 WHERE b >= 'te' and (a % 2);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 p0,p1,p2 range b b 7 NULL 4 100.00 Using index condition; Using where
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`b`) AS `HEX(b)` from `test`.`t1` where ((`test`.`t1`.`b` >= 'te') and (`test`.`t1`.`a` % 2))
EXPLAIN FORMAT=JSON SELECT a, HEX(b) FROM t1 WHERE b >= 'te' and (a % 2);
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "6.61"
},
"table": {
"table_name": "t1",
"partitions": [
"p0",
"p1",
"p2"
],
"access_type": "range",
"possible_keys": [
"b"
],
"key": "b",
"used_key_parts": [
"b"
],
"key_length": "7",
"rows_examined_per_scan": 4,
"rows_produced_per_join": 4,
"filtered": "100.00",
"index_condition": "(`test`.`t1`.`a` % 2)",
"cost_info": {
"read_cost": "5.81",
"eval_cost": "0.80",
"prefix_cost": "6.61",
"data_read_per_join": "160"
},
"used_columns": [
"a",
"b"
],
"attached_condition": "(`test`.`t1`.`b` >= 'te')"
}
}
}
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`b`) AS `HEX(b)` from `test`.`t1` where ((`test`.`t1`.`b` >= 'te') and (`test`.`t1`.`a` % 2))
SELECT a, HEX(b) FROM t1 WHERE b >= 'te' and (a % 2);
a HEX(b)
1 DEADBEEF
5 746573742074657874
DROP TABLE t1;