You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#34787357 Hypergraph: row estimates for field=non_field_term ignores indexes and histogram [2/2]
This patch concerns selectivity estimates for the Hypergraph optimizer, for
predicates like:
table.field <op> <expression>
where <expression> is something else than a field, and independent of
'table'. If <op> is '=' the selectivity of these predicates was previously
estimated as 1.0 or 0.1, depending on the specific predicate.
But if we have statistics (index or histogram) on the number of
distinct values for 'field', and make the assumption that the value of
<expression> is uniformly distributed over the values of 'field', we
can make a better estimate as:
selectivity = 1.0 / <number of distinct values>
This patch makes such estimates if a suitable histogram or index can
be found. The patch also makes a similar change when <op> is '<>'
(i.e. not equal). Previously, we estimate the selectivity to be 1.0
or 0.9, depending on the specific predicate. And now, if we have a
suitable index or histogram, we make the following estimate:
predicates like:
selectivity = 1.0 - 1.0 / <number of distinct values>
For the '<', '>', '<=' and '>=' operators, we previously estimated the
selectivity to 1.0 if <expression> was an (independent) subquery or
non-deterministic. Now we use the default value for other types of
expressions for these operators (i.e. 0.33).
Change-Id: I34c307b12216025bedf6e995ee89a58793f59aac
0 commit comments