Re: VACUUM FULL doesn't reduce table size

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: pinker <pinker(at)onet(dot)eu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: VACUUM FULL doesn't reduce table size
Date: 2015-03-06 14:26:43
Message-ID: 20150306142642.GY3291@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pinker 2015-03-06 14:43:25 Re: VACUUM FULL doesn't reduce table size
Previous Message Patrick Dung 2015-03-06 14:05:59 Re: Find similar records (compare tsvectors)