summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2018-12-07 02:12:22 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2018-12-07 19:59:45 +0530
commit4886d14827c69877e8d089ae7c7f178a9a54ad7a (patch)
tree3e059163c76f6b52fae3b09d8e6cfee87da33814 /sql/opt_range.cc
parent12b1ba195cb0802053bc2fae3b507ec9721685f8 (diff)
downloadmariadb-git-4886d14827c69877e8d089ae7c7f178a9a54ad7a.tar.gz
MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
The problem here is EITS statistics does not calculate statistics for the partitions of the table. So a temporary solution would be to not read EITS statistics for partitioned tables. Also disabling reading of EITS for columns that participate in the partition list of a table.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index a3943cbe3ff..005ae92a665 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3322,14 +3322,17 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
{
Field **field_ptr;
TABLE *table= param->table;
+ partition_info *part_info= NULL;
+ #ifdef WITH_PARTITION_STORAGE_ENGINE
+ part_info= table->part_info;
+ #endif
uint parts= 0;
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- Column_statistics* col_stats= (*field_ptr)->read_stats;
- if (bitmap_is_set(used_fields, (*field_ptr)->field_index)
- && col_stats && !col_stats->no_stat_values_provided()
- && !((*field_ptr)->type() == MYSQL_TYPE_GEOMETRY))
+ Field *field= *field_ptr;
+ if (bitmap_is_set(used_fields, field->field_index) &&
+ is_eits_usable(field))
parts++;
}
@@ -3347,12 +3350,10 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
uint max_key_len= 0;
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- if (bitmap_is_set(used_fields, (*field_ptr)->field_index))
+ Field *field= *field_ptr;
+ if (bitmap_is_set(used_fields, field->field_index))
{
- Field *field= *field_ptr;
- Column_statistics* col_stats= field->read_stats;
- if (field->type() == MYSQL_TYPE_GEOMETRY ||
- !col_stats || col_stats->no_stat_values_provided())
+ if (!is_eits_usable(field))
continue;
uint16 store_length;