diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2009-11-17 20:02:16 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2009-11-17 20:02:16 +0100 |
commit | 87349334004e7f3ae3beeb347661ffba18df3e38 (patch) | |
tree | 493534d6935bec4d100c4503f445487e0a2a553e /sql/ha_partition.h | |
parent | 552965eff927dff2f0248169e5c0510ef3783ccf (diff) | |
download | mariadb-git-87349334004e7f3ae3beeb347661ffba18df3e38.tar.gz |
Bug#48846: Too much time spent in ha_partition::records_in_range if not able to prune
Problem was that ha_partition::records_in_range called
records_in_range for all non pruned partitions, even if
an estimate should be given.
Solution is to only use 1/3 of the partitions (up to 10) for
records_in_range and estimate the total from this subset.
(And continue until a non zero return value from the called
partitions records_in_range is given, since 0 means no rows
will match.)
sql/ha_partition.cc:
Bug#48846: Too much time spent in ha_partition::records_in_range if not able to prune
estimate_rows_upper_bound and records_in_range are very similar
(the only difference is the function and its parameters to use)
so I created a common function for this.
Since these calls from the optimizer are only estimates, it is
not neccesary to call them for every partition, it can use
a much smaller subset of the used partitions instead,
which improves performance for selects.
sql/ha_partition.h:
Bug#48846: Too much time spent in ha_partition::records_in_range if not able to prune
Added two private functions to help some
optimizer calls.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index c08b1f77eca..9f6d9e0a5ba 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -547,6 +547,18 @@ public: ------------------------------------------------------------------------- */ +private: + /* + Helper function to get the minimum number of partitions to use for + the optimizer hints/cost calls. + */ + void partitions_optimizer_call_preparations(uint *num_used_parts, + uint *check_min_num, + uint *first); + ha_rows estimate_rows(bool is_records_in_range, uint inx, + key_range *min_key, key_range *max_key); +public: + /* keys_to_use_for_scanning can probably be implemented as the intersection of all underlying handlers if mixed handlers are used. |