1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows

Do not collect EITS statistics for this statement:

  ALTER TABLE t ANALYZE PARTITION p

EITS stats are currently global, not per-partition.
Collecting global stats when we are asked to process just one partition
causes issues for DBAs.
This commit is contained in:
Sergei Petrunia
2020-07-29 23:26:09 +03:00
parent e54a7ac1b3
commit 7e9ffc69ec
4 changed files with 71 additions and 4 deletions

View File

@@ -727,8 +727,18 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
{
compl_result_code= result_code= HA_ADMIN_INVALID;
}
/*
The check for Alter_info::ALTER_ADMIN_PARTITION implements this logic:
do not collect EITS STATS for this syntax:
ALTER TABLE ... ANALYZE PARTITION p
EITS statistics is global (not per-partition). Collecting global stats
is much more expensive processing just one partition, so the most
appropriate action is to just not collect EITS stats for this command.
*/
collect_eis=
(table->table->s->table_category == TABLE_CATEGORY_USER &&
!(lex->alter_info.flags &= Alter_info::ALTER_ADMIN_PARTITION) &&
(get_use_stat_tables_mode(thd) > NEVER ||
lex->with_persistent_for_clause));