> ... sometimes ... 'n_distinct' for this column
> gets a value of '-1' (desireable), and other times a value such as 56596
> or something.
> This is with the default setting for the statistics.
> Doing a 'SET STATISTICS 40' on the column got me to '-0.106047', which
> is better. But even so, the values do change somewhat over subsequent
> runs of VACUUM ANALYZE. And sometimes I get the coveted '-1'.
I'm guessing that your table is not randomly populated, so that the new
"statistically sampled ANALYZE" is sometimes getting a good sample (or
at least one with the result you want) and sometimes getting a terrible
one.
Tom?
- Thomas