Gregory Stark <[EMAIL PROTECTED]> wrote: > > 4. ANALYZE finishes in a short time. > There was a paper with a nice algorithm posted a while back which required > only constant memory but it depended on scanning the entire table. I think to > do n_distinct estimates we'll need some statistics which are either gathered > opportunistically whenever a seqscan happens or maintained by an index.
VACUUM would be another good timing for the alogrithm, because it does a seqscan. If we do so, we need to separate an analyzing transaction into sampling and updating-stats transactions to keep vacuums as ignorable transactions. However, VACUUM will not do a seqscan when we have Dead Space Map or Segment Visibility Map. We will need incremental statistics updating if reliable n_distinct estimation requires many samples. Regards, --- ITAGAKI Takahiro NTT Open Source Software Center ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend