DROP COLUMN & TOASTED DATA

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: DROP COLUMN & TOASTED DATA
Date: 2002-08-30 07:52:15
Message-ID: GNELIHDDFBOCMGBFGEFOMEPKCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I proved that you can reclaim on disk space after a DROP COLUMN with toast
tables:

test=# create table toast_test(a text, b text);
CREATE TABLE
test=# insert into toast_test values (repeat('XXXXXXXXXX', 1000000),
repeat('XXXXXXXXXX', 1000000));
INSERT 246368 1
test=# insert into toast_test values (repeat('XXXXXXXXXX', 1000000),
repeat('XXXXXXXXXX', 1000000));
INSERT 246371 1

Gives:

-rw------- 1 chriskl users 8192 Aug 30 15:46 246363
-rw------- 1 chriskl users 475136 Aug 30 15:47 246365
-rw------- 1 chriskl users 16384 Aug 30 15:46 246367

test=# alter table toast_test drop a;
ALTER TABLE
test=# update toast_test set b = b;
UPDATE 2

Gives:

-rw------- 1 chriskl users 8192 Aug 30 15:46 246363
-rw------- 1 chriskl users 475136 Aug 30 15:48 246365
-rw------- 1 chriskl users 16384 Aug 30 15:46 246367

test=# vacuum full toast_test;
VACUUM
test=# checkpoint;
CHECKPOINT

Gives:

-rw------- 1 chriskl users 8192 Aug 30 15:48 246363
-rw------- 1 chriskl users 237568 Aug 30 15:48 246365
-rw------- 1 chriskl users 16384 Aug 30 15:48 246367

Seems to halve the space used which is what you'd expect.

Chris

Browse pgsql-hackers by date

  From Date Subject
Next Message Nigel J. Andrews 2002-08-30 11:22:01 Re: Fulltextindex
Previous Message Christopher Kings-Lynne 2002-08-30 07:08:54 Re: Fulltextindex