diff options
author | Igor Babaev <igor@askmonty.org> | 2013-01-13 02:11:22 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-01-13 02:11:22 -0800 |
commit | 557303b831751e6b063fc6eef9814078e526214d (patch) | |
tree | a94144b2e1c2f9c4bafc741b768823657a5d492f /sql/sql_statistics.cc | |
parent | bc75820fb7fa4c945c164dea9eac8e19058d7605 (diff) | |
parent | 7d5c56cb410bd0363e1c66c31149a79086584bbb (diff) | |
download | mariadb-git-557303b831751e6b063fc6eef9814078e526214d.tar.gz |
Merged the fix for bug mdev-4019.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r-- | sql/sql_statistics.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 618fd9b7799..70ba6897333 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2499,6 +2499,8 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables) } } + table->stats_is_read= TRUE; + DBUG_RETURN(0); } @@ -2557,6 +2559,8 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables) table_share->stats_cb.stats_can_be_read && !table_share->stats_cb.stats_is_read) return TRUE; + if (table_share->stats_cb.stats_is_read) + tl->table->stats_is_read= TRUE; } } @@ -2616,6 +2620,8 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables) (void) read_statistics_for_table(thd, tl->table, stat_tables); table_share->stats_cb.stats_is_read= TRUE; } + if (table_share->stats_cb.stats_is_read) + tl->table->stats_is_read= TRUE; } } @@ -3034,7 +3040,7 @@ void set_statistics_for_table(THD *thd, TABLE *table) Use_stat_tables_mode use_stat_table_mode= get_use_stat_tables_mode(thd); table->used_stat_records= (use_stat_table_mode <= COMPLEMENTARY || - !stats_cb->stats_is_read || read_stats->cardinality_is_null) ? + !table->stats_is_read || read_stats->cardinality_is_null) ? table->file->stats.records : read_stats->cardinality; KEY *key_info, *key_info_end; for (key_info= table->key_info, key_info_end= key_info+table->s->keys; @@ -3042,7 +3048,7 @@ void set_statistics_for_table(THD *thd, TABLE *table) { key_info->is_statistics_from_stat_tables= (use_stat_table_mode > COMPLEMENTARY && - stats_cb->stats_is_read && + table->stats_is_read && key_info->read_stats->avg_frequency_is_inited() && key_info->read_stats->get_avg_frequency(0) > 0.5); } |