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)
{ {
@ -4876,11 +4877,14 @@ public:
handler_stats_updated(); handler_stats_updated();
} }
inline void ha_handler_stats_disable() inline void ha_handler_stats_disable()
{
if (handler_stats)
{ {
handler_stats= 0; handler_stats= 0;
active_handler_stats.active= 0; active_handler_stats.active= 0;
handler_stats_updated(); handler_stats_updated();
} }
}
private: private:
/* Cache result to avoid extra calls */ /* Cache result to avoid extra calls */