Re: impact of truncate table on indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dbhandary(at)iii(dot)com
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: impact of truncate table on indexes
Date: 2011-12-22 18:40:22
Message-ID: 17582.1324579222@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Dinesh Bhandary <dbhandary(at)iii(dot)com> writes:
> We have been having some performance issues with indexes right after
> truncating a table.

You'd need to be a lot more specific than that if you want useful help.
Also, pgsql-performance is a better list for discussing performance
issues.
http://wiki.postgresql.org/wiki/SlowQueryQuestions

> My understanding is truncate removes all the
> contents of the table and the space get reclaimed immediately.
> In such cases what happens to its indexes.

They get rebuilt as empty indexes.

> It does not seem like they
> are removed, but merely marked for deletion by a vacuum job and it
> creates huge bloats and performance problems.

On what do you base this clearly-contrary-to-reality conclusion?

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2011-12-22 18:45:22 Re: Problem with pgstat timneouts
Previous Message Benjamin Krajmalnik 2011-12-22 18:25:46 Re: Problem with pgstat timneouts