Re: VACUUM FULL doesn't reduce table size - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: VACUUM FULL doesn't reduce table size
Date
Msg-id 20150306142642.GY3291@alvh.no-ip.org
Whole thread Raw
In response to VACUUM FULL doesn't reduce table size  (pinker <pinker@onet.eu>)
Responses Re: VACUUM FULL doesn't reduce table size
List pgsql-general
pinker wrote:
> I have deleted a large number of records from my_table, which originally had
> 288 MB. Then I ran vacuum full to make the table size smaller. After this
> operation size of the table remains the same, despite of the fact that table
> contains now only 241 rows and after rewriting it in classic way: CREATE
> TABLE new_table AS SELECT * FROM old_table - new_table size is 24kB.
> What went wrong? And how can I remove those blocks?

Normally this happens when you have transactions that are older than the
delete, so the deleted rows cannot be removed by vacuum because that
transaction might still see them. If you close all old transactions,
vacuum full would be able to reclaim all the space.  You might have
prepared transactions also, see select * from pg_prepared_xacts;

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-general by date:

Previous
From: Patrick Dung
Date:
Subject: Re: Find similar records (compare tsvectors)
Next
From: pinker
Date:
Subject: Re: VACUUM FULL doesn't reduce table size