On Fri, Sep 2, 2011 at 12:45 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > column values). But GROUP BY or DISTINCT would entirely invalidate the > column frequency statistics, which makes me think that ignoring the > pg_statistic entry might be the thing to do. Comments?
There's a possible problem there in that you may have trouble getting a good join selectivity estimate in cases like: SELECT ... FROM foo LEFT JOIN (SELECT x, SUM(1) FROM bar GROUP BY 1) ON foo.x = bar.x My guess is that in practice, the number of rows in foo that find a join partner here is going to be much higher than what a stats-less join selectivity estimation is likely to come up with. You typically don't write a query like this in the first place if you don't expect to find matches, although I'm sure it's been done. In some cases you might even have a foreign key relationship to work with. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers