Commit d4e1731f authored by Monty's avatar Monty

Optimize handler_stats_disable() when handler_stats are already disabled

MDEV-33502 Slowdown when running nested statement with many partitions
parent a8f6b86c
...@@ -3456,6 +3456,7 @@ class handler :public Sql_alloc ...@@ -3456,6 +3456,7 @@ class handler :public Sql_alloc
("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d", ("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d",
F_UNLCK, F_RDLCK, F_WRLCK)); F_UNLCK, F_RDLCK, F_WRLCK));
reset_statistics(); reset_statistics();
active_handler_stats.active= 0;
} }
virtual ~handler(void) virtual ~handler(void)
{ {
...@@ -4877,9 +4878,12 @@ class handler :public Sql_alloc ...@@ -4877,9 +4878,12 @@ class handler :public Sql_alloc
} }
inline void ha_handler_stats_disable() inline void ha_handler_stats_disable()
{ {
handler_stats= 0; if (handler_stats)
active_handler_stats.active= 0; {
handler_stats_updated(); handler_stats= 0;
active_handler_stats.active= 0;
handler_stats_updated();
}
} }
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment