Optimize handler_stats_disable() when handler_stats are already disabled

MDEV-33502 Slowdown when running nested statement with many partitions
This commit is contained in:
Monty 2024-02-18 16:05:42 +02:00
parent a8f6b86c90
commit d4e1731fbc

View File

@ -3456,6 +3456,7 @@ public:
("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 @@ public:
} }
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: