Re: Truncating table in PSQL reclaims hard disk?

From: s d <daku(dot)sandor(at)gmail(dot)com>
To: Freeda Suing <freeda(dot)suing(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Truncating table in PSQL reclaims hard disk?
Date: 2015-08-24 11:38:40
Message-ID: CAKyoTgbhKDDAfecyxvBgOGaGaaYfPRP+a8xAprx6NK-N1PNR7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 24 August 2015 at 13:07, Freeda Suing <freeda(dot)suing(at)gmail(dot)com> wrote:

> Hi,
>
> Does truncating a table automatically re-claim the hard disk or do I need
> to initiate vacuum after the truncate.
>
> Thanks
>

From the documentation(
http://www.postgresql.org/docs/9.4/static/sql-truncate.html)
TRUNCATE quickly removes all rows from a set of tables. It has the same
effect as an unqualified DELETE on each table, but since it does not
actually scan the tables it is faster. Furthermore, it reclaims disk space
immediately, rather than requiring a subsequent VACUUM operation. This is
most useful on large tables.

Regards,
Sandor

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Daniel Smedegaard Buus 2015-08-28 07:04:23 Triggers on replicated (BDR) data
Previous Message Freeda Suing 2015-08-24 11:07:27 Truncating table in PSQL reclaims hard disk?