>
> Bruce Momjian wrote:
> >
> > > *** Btw, why doesn't PG update statistics when inserting/updating?
> >
> > Too slow to do at that time. You need to span all the data to get an
> > accurate figure.
>
> Is it not possible to take the current statistics and the latest
> changes and calculate new statistics from that?
>
> What information is kept in these statistics? How are they used?
> Obviously this is more than just number of rows, but what exactly?
Look in commands/vacuum.c. It measures the spread-ness of the data, and
there is no way to get this figure on-the-fly unless you maintain
buckets for each range of data values and decrement/increment as values
are added-subtraced. Seeing a the MySQL optimizer is a single file, and
so is the executor, I doubt that is what it is doing. Probably just
keeps a count of how many rows in the table.
--
Bruce Momjian
maillist@candle.pha.pa.us