Is stats update during COPY IN really a good idea? - Mailing list pgsql-hackers

From Tom Lane
Subject Is stats update during COPY IN really a good idea?
Date
Msg-id 29033.990463522@sss.pgh.pa.us
Whole thread Raw
Responses Re: Is stats update during COPY IN really a good idea?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
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.  The problem is that updating pg_class.reltuples
means that concurrent COPY operations will block each other, because
they want to update the same row in pg_class.  You can already see this
happen in CREATE INDEX:
create table foo(f1 int);begin;create index fooey on foo(f1);

-- in another psql do
create index fooey2 on foo(f1);

-- second backend blocks until first xact is committed or rolled back.

While this doesn't bother me for CREATE INDEX, it does bother me for
COPY, since people often use COPY to avoid per-tuple INSERT overhead.
It seems pretty likely that this will cause blocking problems for real
applications.  I think that may be a bigger problem than the benefit of
not needing a VACUUM (or, now, ANALYZE) to get the stats updated.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Mikheev, Vadim"
Date:
Subject: RE: Plans for solving the VACUUM problem
Next
From: Zeugswetter Andreas SB
Date:
Subject: AW: AW: Plans for solving the VACUUM problem