summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-04-22 17:10:42 -0700
committerIgor Babaev <igor@askmonty.org>2019-04-22 17:11:07 -0700
commit279a907fd0dea30be6d11fc4a5d63b1b98d0b329 (patch)
tree23cf9722a9aaf85b2dee4fbb9419c93cc7d3f89e /sql/sql_statistics.cc
parenta4f7d859322ab771289abf13f50752266af43187 (diff)
downloadmariadb-git-279a907fd0dea30be6d11fc4a5d63b1b98d0b329.tar.gz
MDEV-17605 Statistics for InnoDB table is wrong if persistent statistics is used
The command SHOW INDEXES ignored setting of the system variable use_stat_tables to the value of 'preferably' and and showed statistical data received from the engine. Similarly queries over the table STATISTICS from INFORMATION_SCHEMA ignored this setting. It happened because the function fill_schema_table_by_open() did not read any data from statistical tables.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index d3a2094e272..b435971a4d6 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -2177,7 +2177,10 @@ inline bool statistics_for_command_is_needed(THD *thd)
{
if (thd->bootstrap || thd->variables.use_stat_tables == NEVER)
return FALSE;
-
+
+ if (thd->force_read_stats)
+ return TRUE;
+
switch(thd->lex->sql_command) {
case SQLCOM_SELECT:
case SQLCOM_INSERT: