Gregory Stark <st...@enterprisedb.com> writes: > For that matter, if we do consider sampling 5% of the table we may as well > just go ahead and scan the whole table. It wouldn't take much longer and it > would actually produce good estimates.
Yeah. Anything over a small fraction of a percent is going to imply fetching every page anyway, for typical row widths. If you want ANALYZE to be cheap then you simply don't get to have a trustworthy value of ndistinct. Perhaps a better plan is to try to de-emphasize use of ndistinct, though I concede I have no idea how to do that. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers