Re: [HACKERS] Re: [QUESTIONS] Business cases - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: [QUESTIONS] Business cases
Date
Msg-id 199801201445.JAA02244@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: [QUESTIONS] Business cases  (Mattias Kregert <matti@algonet.se>)
List pgsql-hackers
>
> 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

pgsql-hackers by date:

Previous
From: Mattias Kregert
Date:
Subject: Small changes for the "no excuses" release
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: Var->sublevels_up