> On Aug 20, 2021, at 11:20 AM, Tomas Vondra <tomas.vondra@enterprisedb.com> wrote:
>
> I think we can either reject the patch, which would mean we don't consider (Var op Var) clauses to be
common/importantenough. Or we need to improve the existing selectivity functions (even those without extended
statistics)to handle those clauses in a smarter way. Otherwise there'd be strange/surprising inconsistencies.
For datatypes with very few distinct values (bool, some enums, etc.) keeping an mcv list of (a,b) pairs seems helpful.
Thepatch may be worth keeping for such cases. In other cases, I don't much see the point.
It seems that sampling the fraction of rows where (A op B) is true for any given op would be more helpful.
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company