mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
The issue here was histogram statistics were being used even when the level of optimizer_use_condition_selectivity doesn't allow usage of statistics from histogram. The histogram statistics are read for a table only when optimizer_use_condition_selectivity > 3. But the TABLE structure can be stored in the internal table cache and be reused for the next query. So in this case the histogram statistics will be available for the next query. The fix would be to make sure to use the histogram statistics only when optimizer_use_condition_selectivity > 3.
This commit is contained in:
@ -212,6 +212,17 @@ public:
|
||||
|
||||
bool is_available() { return get_size() > 0 && get_values(); }
|
||||
|
||||
/*
|
||||
This function checks that histograms should be usable only when
|
||||
1) the level of optimizer_use_condition_selectivity > 3
|
||||
2) histograms have been collected
|
||||
*/
|
||||
bool is_usable(THD *thd)
|
||||
{
|
||||
return thd->variables.optimizer_use_condition_selectivity > 3 &&
|
||||
is_available();
|
||||
}
|
||||
|
||||
void set_value(uint i, double val)
|
||||
{
|
||||
switch (type) {
|
||||
|
Reference in New Issue
Block a user