summaryrefslogtreecommitdiff
path: root/mysql-test/t/partition_range.test
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2010-03-04 12:09:09 +0100
committerMattias Jonsson <mattias.jonsson@sun.com>2010-03-04 12:09:09 +0100
commite46d120e8ef7de8660d10a96f8cfee47e8836b53 (patch)
tree192b9147cfa1de054d482806c80fa69dd6b55e62 /mysql-test/t/partition_range.test
parentae3e094191d2d48c5468a6fd8e09a54e687cb3e8 (diff)
downloadmariadb-git-e46d120e8ef7de8660d10a96f8cfee47e8836b53.tar.gz
Bug#48229: group by performance issue of partitioned table
Problem was block_size on partitioned tables was not set, resulting in keys_per_block was not correct which affects the cost calculation for read time of indexes (including cost for group min/max).Which resulted in a bad optimizer decision. Fixed by setting stats.block_size correctly. mysql-test/r/partition_range.result: Bug#48229: group by performance issue of partitioned table Added result mysql-test/t/partition_range.test: Bug#48229: group by performance issue of partitioned table Added test sql/ha_partition.cc: Bug#48229: group by performance issue of partitioned table Added missing assignment of stats.block_size.
Diffstat (limited to 'mysql-test/t/partition_range.test')
-rw-r--r--mysql-test/t/partition_range.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
index c02d9049f2e..4d011ddc468 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -9,6 +9,24 @@
drop table if exists t1, t2;
--enable_warnings
+--echo #
+--echo # Bug#48229: group by performance issue of partitioned table
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ KEY a (a,b)
+)
+PARTITION BY HASH (a) PARTITIONS 1;
+
+# insert some rows (i.e. so that rows/blocks > 1)
+INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020);
+
+# Before the fix the 'Extra' column showed 'Using index for group-by'
+EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
+
+DROP TABLE t1;
+
#
# BUG 33429: Succeeds in adding partition when maxvalue on last partition
#