On Fri, 2008-12-12 at 11:16 -0500, Tom Lane wrote: > If you want ANALYZE to be cheap then you simply don't get to have > a trustworthy value of ndistinct.
Understood, but a cheap ANALYZE isn't always a higher priority than all other considerations. Solutions can also include * allowing user to note that we would actually like to scan the whole table (stats_target = -2?) * manual mechanism for setting ndistinct that doesn't keep getting overwritten by subsequent ANALYZEs * have the executor do non-transactional update of the value of ndistinct if it ever builds a hash table that is larger than expected (simple learning optimizer action) -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers