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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to