Re: A 154 GB table swelled to 527 GB on the Slony slave. How to compact it? - Mailing list pgsql-general

From Filip Rembiałkowski
Subject Re: A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?
Date
Msg-id CAP_rwwmT83d_Luyp8_ZaTtDbuM7mXbq57XJ-TT4BMq66hrooMg@mail.gmail.com
Whole thread Raw
In response to Re: A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?  (Aleksey Tsalolikhin <atsaloli.tech@gmail.com>)
Responses Re: A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?  (Greg Williamson <gwilliamson39@yahoo.com>)
List pgsql-general
On Thu, Mar 15, 2012 at 6:43 AM, Aleksey Tsalolikhin <atsaloli.tech@gmail.com> wrote:

Is there any way to consolidate the pages on the slave without taking
replication offline?

maybe CLUSTER?

filip@dev=> create table foobar (id serial primary key, load text);
CREATE TABLE
filip@dev=> insert into foobar(load)select md5(random()::text) from generate_series(1,100000);
INSERT 0 100000
filip@dev=> delete from foobar where id%4<>3; -- delete 75% of the table
DELETE 75000
filip@dev=> select pg_relation_size('foobar');
 pg_relation_size
------------------
          6832128
(1 row)

filip@dev=> CLUSTER foobar using foobar_pkey;
CLUSTER
filip@dev=> select pg_relation_size('foobar');
 pg_relation_size
------------------
          1712128
(1 row)

Of course events destined to this table will be queued by Slony while the table is locked.


Filip



pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Temporal foreign keys
Next
From: Samba
Date:
Subject: Re: Indexing MS/Open Office and PDF documents