Thread: AW: Is stats update during COPY IN really a good idea?

AW: Is stats update during COPY IN really a good idea?

From
Zeugswetter Andreas SB
Date:
> We have a TODO item
>     * Update reltuples in COPY
> 
> I was just about to go do this when I realized that it may not be such
> a hot idea after all.

Imho it is not a good idea at all. The statistics are a very sensitive area,
that imho should only be calculated on request. I already don't like the
statistics that are implicitly created during create index.

Eighter you have online stats keeping or you don't.
For me this is a definite all or nothing issue. Anything inbetween is 
only good for unpleasant surprises.

I have very strong feelings about this, because of bad experience.
I would be willing to go into detail.

A syntactic extension to copy ("with analyze") on the other hand would 
be a feature.

Andreas


Re: AW: Is stats update during COPY IN really a good idea?

From
Bruce Momjian
Date:
[ Charset ISO-8859-1 unsupported, converting... ]
> 
> > We have a TODO item
> >     * Update reltuples in COPY
> > 
> > I was just about to go do this when I realized that it may not be such
> > a hot idea after all.
> 
> Imho it is not a good idea at all. The statistics are a very sensitive area,
> that imho should only be calculated on request. I already don't like the
> statistics that are implicitly created during create index.

OK, if you feel strongly, and Tom does, I will remove the item. 
However, just remember that pg_class already has a row count that we
force in there by default.
test=> create table test (x int);CREATEtest=> select reltuples from pg_class where relname = 'test'; reltuples
-----------     1000(1 row)
 

I was just suggesting we make that accurate if we can, even if we can
make it accurate only 80% of the time.  Once we INSERT, it isn't
accurate anymore anyway.  This is just an estimate, and in my mind, it
doesn't have to be accurate in all cases.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026