MySql Partitioning problem (bug?)
Posted by:
K T
Date: May 07, 2014 04:39PM
Hi all
I`m using mysql 5.5.37 on ubuntu 12.04 (5.5.37-0ubuntu0.12.04.1)
and I got strange problem.
so I have a table:
-------
CREATE TABLE `test_table` (
`test_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`test_id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8
PARTITION BY HASH ( test_id DIV 1000)
PARTITIONS 50;
-------
filled with random values, etc..
and now our tests:
----
query 1:
EXPLAIN PARTITIONS SELECT test_id
FROM test_table
WHERE test_id BETWEEN 1 AND 999;
result 1:
.. partitions: p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49
----
query 2:
EXPLAIN PARTITIONS SELECT test_id
FROM test_table
WHERE (
(test_id >= 1 AND test_id <= 100) OR
(test_id >= 101 AND test_id <= 200) OR
(test_id >= 201 AND test_id <= 300) OR
(test_id >= 301 AND test_id <= 400) OR
(test_id >= 401 AND test_id <= 500) OR
(test_id >= 501 AND test_id <= 600) OR
(test_id >= 601 AND test_id <= 700) OR
(test_id >= 701 AND test_id <= 800) OR
(test_id >= 801 AND test_id <= 900) OR
(test_id >= 901 AND test_id <= 999)
);
result 2:
.. partitions:
p0
----
So either "explain partitions" is not working correctly or mysql handle queries to the partitioned tabled wrong way...
wtf? why does it happen? bug?