Below is the list of changes that have just been committed into a local
5.1 repository of psergey. When psergey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1998 05/12/29 09:32:46 sergefp@stripped +4 -0
WL#2985 "Partition Pruning": post-review fixes: Better comments
sql/opt_range.cc
1.193 05/12/29 09:32:38 sergefp@stripped +17 -14
WL#2985 "Partition Pruning": post-review fixes: Better comments
sql/handler.h
1.175 05/12/29 09:32:38 sergefp@stripped +2 -2
WL#2985 "Partition Pruning": post-review fixes: comments
mysql-test/t/partition_pruning.test
1.4 05/12/29 09:32:38 sergefp@stripped +14 -1
WL#2985 "Partition Pruning": more tests
mysql-test/r/partition_pruning.result
1.4 05/12/29 09:32:38 sergefp@stripped +15 -0
WL#2985 "Partition Pruning": more tests
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: sergefp
# Host: newbox.mylan
# Root: /home/psergey/mysql-5.1-ppruning-r4
--- 1.174/sql/handler.h 2005-12-26 14:54:47 +03:00
+++ 1.175/sql/handler.h 2005-12-29 09:32:38 +03:00
@@ -567,9 +567,9 @@
*/
get_subpart_id_func get_subpartition_id;
- /* NULL-terminated list of fields used in partitioned expression */
+ /* NULL-terminated array of fields used in partitioned expression */
Field **part_field_array;
- /* NULL-terminated list of fields used in subpartitioned expression */
+ /* NULL-terminated array of fields used in subpartitioned expression */
Field **subpart_field_array;
/*
--- 1.192/sql/opt_range.cc 2005-12-27 15:04:27 +03:00
+++ 1.193/sql/opt_range.cc 2005-12-29 09:32:38 +03:00
@@ -2246,11 +2246,11 @@
/***************************************************************
Following fields are used to store an 'iterator' that can be
- used to obtain a set of used artitions.
+ used to obtain a set of used partitions.
**************************************************************/
/*
Start and end+1 partition "numbers". They can have two meanings depending
- depending of the value of part_num_to_part_id:
+ of the value of part_num_to_part_id:
part_num_to_part_id_range - numbers are partition ids
part_num_to_part_id_list - numbers are indexes in part_info->list_array
*/
@@ -2536,7 +2536,7 @@
List<SEL_IMERGE> represents "imerge1 AND imerge2 AND ...".
The set of used partitions is an intersection of used partitions sets
for imerge_{i}.
- We accumulate this intersection a separate bitmap.
+ We accumulate this intersection in a separate bitmap.
RETURN
See find_used_partitions()
@@ -2554,7 +2554,7 @@
bitmap_bytes)))
{
/*
- Fallback, process just first SEL_IMERGE. This can leave us with more
+ Fallback, process just the first SEL_IMERGE. This can leave us with more
partitions marked as used then actually needed.
*/
return find_used_partitions_imerge(ppar, merges.head());
@@ -2623,20 +2623,20 @@
/*
- Recursively walk the SEL_ARG tree, find/mark partitions that need to be used
+ Collect partitioning ranges for the SEL_ARG tree and mark partitions as used
SYNOPSIS
find_used_partitions()
ppar Partition pruning context.
- key_tree Intervals tree to perform pruning for.
+ key_tree SEL_ARG range tree to perform pruning for
DESCRIPTION
This function
- * recursively walks the SEL_ARG* tree collecting partitioning
- "intervals";
- * finds the partitions one needs to use to get rows in these intervals;
- * marks these partitions as used.
-
+ * recursively walks the SEL_ARG* tree collecting partitioning "intervals"
+ * finds the partitions one needs to use to get rows in these intervals
+ * marks these partitions as used
+
+ NOTES
WHAT IS CONSIDERED TO BE "INTERVALS"
A partition pruning "interval" is equivalent to condition in one of the
forms:
@@ -2687,7 +2687,7 @@
{
/*
Partitioning is done by RANGE|INTERVAL(monotonic_expr(fieldX)), and
- we got "const1 < fieldX < const2" interval.
+ we got "const1 CMP fieldX CMP const2" interval
*/
DBUG_EXECUTE("info", dbug_print_segment_range(key_tree,
ppar->range_param.
@@ -2761,7 +2761,7 @@
DBUG_EXECUTE("info", dbug_print_singlepoint_range(ppar->arg_stack,
ppar->part_fields););
uint32 part_id;
- /* then find in which partition the {const1, ...,constN} tuple goes */
+ /* Find in which partition the {const1, ...,constN} tuple goes */
if (ppar->get_top_partition_id_func(ppar->part_info, &part_id))
{
res= 0; /* No satisfying partitions */
@@ -2843,7 +2843,10 @@
if (set_full_part_if_bad_ret)
{
- /* Restore the "used partition iterator" to its default */
+ /*
+ Restore the "used partitions iterator" to the default setting that
+ specifies iteration over all partitions.
+ */
ppar->part_num_to_part_id= part_num_to_part_id_range;
ppar->start_part_num= 0;
ppar->end_part_num= ppar->part_info->no_parts;
--- 1.3/mysql-test/r/partition_pruning.result 2005-12-26 10:16:29 +03:00
+++ 1.4/mysql-test/r/partition_pruning.result 2005-12-29 09:32:38 +03:00
@@ -259,3 +259,18 @@
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
drop table t1;
+create table t1 (a int not null, b int not null, key(a), key(b))
+partition by hash(a) partitions 4;
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+explain partitions
+select * from t1 X, t1 Y
+where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 4 Using where
+1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where
+explain partitions
+select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where
+1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
+drop table t1;
--- 1.3/mysql-test/t/partition_pruning.test 2005-12-26 10:16:29 +03:00
+++ 1.4/mysql-test/t/partition_pruning.test 2005-12-29 09:32:38 +03:00
@@ -230,9 +230,22 @@
insert into t1 values (1),(2);
explain partitions select * from t1 where a is null;
-# this selects both
+# this uses both partitions
explain partitions select * from t1 where a is not null;
drop table t1;
+# Join tests
+create table t1 (a int not null, b int not null, key(a), key(b))
+ partition by hash(a) partitions 4;
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+
+explain partitions
+select * from t1 X, t1 Y
+where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
+
+explain partitions
+select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
+
+drop table t1;
# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
# being fixed.
| Thread |
|---|
| • bk commit into 5.1 tree (sergefp:1.1998) | Sergey Petrunia | 29 Dec |