summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-12-13 21:58:35 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-12-13 21:58:35 +0200
commitf6e16bdc62d80a1b26a955aafb1b60fafa912beb (patch)
treebb2d6126379b0e0518d0064b584b8677d3df8582 /sql/sql_statistics.cc
parent839cf16bb2de078d5000bcb2f9b3151f1ebda708 (diff)
parente3dda3d95ee4c09c2ed45ce886ecd25d1fc1ae92 (diff)
downloadmariadb-git-f6e16bdc62d80a1b26a955aafb1b60fafa912beb.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 8a0c1554869..2384c68115b 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3737,10 +3737,10 @@ void set_statistics_for_table(THD *thd, TABLE *table)
Ideally, EITS should provide per-partition statistics but this is not
implemented currently.
*/
- #ifdef WITH_PARTITION_STORAGE_ENGINE
+#ifdef WITH_PARTITION_STORAGE_ENGINE
if (table->part_info)
table->used_stat_records= table->file->stats.records;
- #endif
+#endif
KEY *key_info, *key_info_end;
for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
@@ -4070,10 +4070,6 @@ bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table)
bool is_eits_usable(Field *field)
{
- partition_info *part_info= NULL;
- #ifdef WITH_PARTITION_STORAGE_ENGINE
- part_info= field->table->part_info;
- #endif
/*
(1): checks if we have EITS statistics for a particular column
(2): Don't use EITS for GEOMETRY columns
@@ -4082,9 +4078,11 @@ bool is_eits_usable(Field *field)
such columns would be handled during partition pruning.
*/
Column_statistics* col_stats= field->read_stats;
- if (col_stats && !col_stats->no_stat_values_provided() && //(1)
- field->type() != MYSQL_TYPE_GEOMETRY && //(2)
- (!part_info || !part_info->field_in_partition_expr(field))) //(3)
- return TRUE;
- return FALSE;
+ return col_stats && !col_stats->no_stat_values_provided() && //(1)
+ field->type() != MYSQL_TYPE_GEOMETRY && //(2)
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ (!field->table->part_info ||
+ !field->table->part_info->field_in_partition_expr(field)) && //(3)
+#endif
+ true;
}