mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-18478 ANALYZE for statement should show selectivity of ICP, part#3
Fix the previous patch: - Only enable handler_stats if thd->should_collect_handler_stats()==true. - Make handler_index_cond_check() work when handler_stats are not enabled.
This commit is contained in:
parent
86e727b1ee
commit
486d42d812
2 changed files with 9 additions and 4 deletions
|
@ -6995,7 +6995,6 @@ extern "C" check_result_t handler_index_cond_check(void* h_arg)
|
|||
check_result_t res;
|
||||
|
||||
DEBUG_SYNC(thd, "handler_index_cond_check");
|
||||
DBUG_ASSERT(h->handler_stats);
|
||||
|
||||
enum thd_kill_levels killed= thd_kill_level(thd);
|
||||
if (unlikely(killed != THD_IS_NOT_KILLED))
|
||||
|
@ -7009,13 +7008,15 @@ extern "C" check_result_t handler_index_cond_check(void* h_arg)
|
|||
if (unlikely(h->end_range) && h->compare_key2(h->end_range) > 0)
|
||||
return CHECK_OUT_OF_RANGE;
|
||||
h->increment_statistics(&SSV::ha_icp_attempts);
|
||||
h->handler_stats->icp_attempts++;
|
||||
if (unlikely(h->handler_stats))
|
||||
h->handler_stats->icp_attempts++;
|
||||
res= CHECK_NEG;
|
||||
if (h->pushed_idx_cond->val_int())
|
||||
{
|
||||
res= CHECK_POS;
|
||||
h->fast_increment_statistics(&SSV::ha_icp_match);
|
||||
h->handler_stats->icp_match++;
|
||||
if (unlikely(h->handler_stats))
|
||||
h->handler_stats->icp_match++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -5871,7 +5871,11 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
|
|||
(*f_ptr)->cond_selectivity= 1.0;
|
||||
}
|
||||
|
||||
file->ha_handler_stats_reset();
|
||||
/* enable and clear or disable engine query statistics */
|
||||
if (thd->should_collect_handler_stats())
|
||||
file->ha_handler_stats_reset();
|
||||
else
|
||||
file->ha_handler_stats_disable();
|
||||
|
||||
notnull_cond= 0;
|
||||
DBUG_ASSERT(!file->keyread_enabled());
|
||||
|
|
Loading…
Reference in a new issue