diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-10-02 22:30:44 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-10-02 22:30:44 +0400 |
commit | 9374fe3d33b267bf12556a26119d6496625f659c (patch) | |
tree | e5396eeec14a2283b36f5b0ff208562a21e7ef99 | |
parent | 1b1b9013a5045983bbb3be68a2e8bc8f81186aea (diff) | |
download | mariadb-git-bb-10.1-svoj-MDEV-19536.tar.gz |
Simplified away statistics_for_command_is_needed().
Removed redundant get_use_stat_tables_mode() check.
-rw-r--r-- | sql/sql_statistics.cc | 63 |
1 files changed, 18 insertions, 45 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 55248efb173..4a1ed9cde4e 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2161,48 +2161,6 @@ int alloc_statistics_for_table(THD* thd, TABLE *table) /** - @brief - Check whether any persistent statistics for the processed command is needed - - @param - thd The thread handle - - @details - The function checks whether any persitent statistics for the processed - command is needed to be read. - - @retval - TRUE statistics is needed to be read - @retval - FALSE Otherwise -*/ - -static -inline bool statistics_for_command_is_needed(THD *thd) -{ - switch(thd->lex->sql_command) { - case SQLCOM_SELECT: - case SQLCOM_INSERT: - case SQLCOM_INSERT_SELECT: - case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: - case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: - case SQLCOM_REPLACE: - case SQLCOM_REPLACE_SELECT: - case SQLCOM_CREATE_TABLE: - case SQLCOM_SET_OPTION: - case SQLCOM_DO: - break; - default: - return FALSE; - } - - return TRUE; -} - - -/** @brief Allocate memory for the statistical data used by a table share @@ -3233,8 +3191,23 @@ int read_histograms_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables) int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables) { - return statistics_for_command_is_needed(thd) ? - read_statistics_for_tables(thd, tables) : 0; + switch (thd->lex->sql_command) { + case SQLCOM_SELECT: + case SQLCOM_INSERT: + case SQLCOM_INSERT_SELECT: + case SQLCOM_UPDATE: + case SQLCOM_UPDATE_MULTI: + case SQLCOM_DELETE: + case SQLCOM_DELETE_MULTI: + case SQLCOM_REPLACE: + case SQLCOM_REPLACE_SELECT: + case SQLCOM_CREATE_TABLE: + case SQLCOM_SET_OPTION: + case SQLCOM_DO: + return read_statistics_for_tables(thd, tables); + default: + return 0; + } } @@ -3250,7 +3223,7 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables) for (TABLE_LIST *tl= tables; tl; tl= tl->next_global) { - if (get_use_stat_tables_mode(thd) > NEVER && tl->table) + if (tl->table) { TABLE_SHARE *table_share= tl->table->s; if (table_share && table_share->table_category == TABLE_CATEGORY_USER && |