Skip site navigation (1) Skip section navigation (2)

Re: Doc patch for truncate.sgml

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: Doc patch for truncate.sgml
Date: 2008-08-28 18:20:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docs
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Devrim GNDZ wrote:
>> !    <command>TRUNCATE</command> rewrites system catalogue entries for
>> !    that table, which makes running <command>ANALYZE</command> on a
>> !    freshly-truncated table is a bad idea, because the statistics will be
>> !    updated to indicate that the table is truly empty.

> If the table is in fact empty, why is it a bad idea to let the 
> statistics reflect that?

I think that this thinking is at least partially obsolete now that
autovacuum/autoanalyze and plan invalidation are in place.  It used to
be that if you truncated a table and then filled it again, any cached
plans that were made while the table was really small would tend to
suck when used with the re-filled table.  But now, autovac will launch
(at least) an ANALYZE against any table that's grown materially, and the
commit of the new analyze stats will result in invalidating any cached
plans.  So the system should be capable of auto-tuning its plans to
changes in table size ... not instantaneously of course, but then you
can't fill a big table instantaneously either.

			regards, tom lane

In response to


pgsql-docs by date

Next:From: Devrim GÜNDÜZDate: 2008-08-28 18:48:18
Subject: Re: Doc patch for truncate.sgml
Previous:From: Peter EisentrautDate: 2008-08-28 17:30:14
Subject: Re: Doc patch for truncate.sgml

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group