Re: WIP: cross column correlation ...
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: PostgreSQL - Hans-Jürgen Schönig <postgres@cybertec.at>
Cc: pgsql-hackers Hackers <pgsql-hackers@postgresql.org>, Boszormenyi Zoltan <zb@cybertec.at>
Date: 2011-02-23T01:58:00Z
Lists: pgsql-hackers
2011/2/22 PostgreSQL - Hans-Jürgen Schönig <postgres@cybertec.at>: > how does it work? we try to find suitable statistics for an arbitrary length list of conditions so that the planner can use it directly rather than multiplying all the selectivities. this should make estimates a lot more precise. > the current approach can be extended to work with expressions and well as "straight" conditions. /me prepares to go down in flames. Personally, I think the first thing we ought to do is add a real, bona fide planner hint to override the selectivity calculation manually, maybe something like this: WHERE (x < 5 AND y = 1) SELECTIVITY (0.1); Then, having provided a method for the DBA to extinguish the raging flames of searing agony which are consuming them while a crocodile chews off their leg and their boss asks them why they didn't use Oracle, we can continue bikeshedding about the best way of fixing this problem in a more user-transparent fashion. As to the approach you've proposed here, I'm not sure I understand what this is actually doing. Selectivity estimates aren't made directly for predicates; they're made based on MCV and histogram information for predicates. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company