Gregory Stark <stark@enterprisedb.com> writes:
> Simon Riggs <simon@2ndQuadrant.com> writes:
>> And I would like it even more if the sample size increased according to
>> table size, since that makes ndistinct values fairly random for large
>> tables.
> Unfortunately _any_ ndistinct estimate based on a sample of the table is going
> to be pretty random.
Yeah, it's a hard problem. It's worth noting though that increasing the
default stats target 10X is already going to result in a 10X increase in
the default sample size, so we should see at least some improvement in
the typical quality of ndistinct estimates.
regards, tom lane