summaryrefslogtreecommitdiff
path: root/sql/opt_histogram_json.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2022-01-11 17:09:55 +0300
committerSergei Petrunia <psergey@askmonty.org>2022-01-19 18:10:12 +0300
commitdae20dde4e7ae3ad6558eac9aa642fcccecaf13b (patch)
treeafe0ffcad411726940448cc2de3579f5f52a8a46 /sql/opt_histogram_json.cc
parentdb8f15be93ff462b738101e7db89bd609455f0fa (diff)
downloadmariadb-git-dae20dde4e7ae3ad6558eac9aa642fcccecaf13b.tar.gz
MDEV-26901: Estimation for filtered rows less precise ... #4
In Histogram_json_hb::point_selectivity(), do return selectivity of 0.0 when the histogram says so. The logic of "Do not return 0.0 estimate as it causes a multiply-by-zero meltdown in cost and cardinality calculations" is moved into records_in_column_ranges() where it is one *once* per column pair (as opposed to doing once per range, which can cause the error to add-up to large number when there are many ranges)
Diffstat (limited to 'sql/opt_histogram_json.cc')
-rw-r--r--sql/opt_histogram_json.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/opt_histogram_json.cc b/sql/opt_histogram_json.cc
index 4305737df1c..73284025511 100644
--- a/sql/opt_histogram_json.cc
+++ b/sql/opt_histogram_json.cc
@@ -921,7 +921,7 @@ double Histogram_json_hb::point_selectivity(Field *field, key_range *endpoint,
The bucket has a single value and it doesn't match! Return a very
small value.
*/
- sel= 1.0 / total_rows;
+ sel= 0.0;
}
else
{