Running vacuum after delete does not remove all space allocated - Mailing list pgsql-general

From Chris Barnes
Subject Running vacuum after delete does not remove all space allocated
Date
Msg-id BLU149-W12A8DA89A8DB49E61D34D5D41E0@phx.gbl
Whole thread Raw
Responses Re: Running vacuum after delete does not remove all space allocated  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
I have deleted the rows in a table and vacuumed full, there appears to be space allocated that after a truncate it removes.
 
Why is this?
 
 
 
\d t8000_us_ts_size_test_2d
     Table "dbprc001.t8000_us_ts_size_test_2d"
    Column     |         Type          | Modifiers
---------------+-----------------------+-----------
 instrument_id | character varying(13) | not null
 value         | numeric(18,6)[]       |
Indexes:
    "t8000_us_ts_size_test_2d_pkey" PRIMARY KEY, btree (instrument_id)

pgdb001=# select pg_size_pretty(pg_total_relation_size('t8000_us_ts_size_test_2d'));
 pg_size_pretty
----------------
 13 MB
 
pgdb001=# delete from t8000_us_ts_size_test_2d;
DELETE 6

pgdb001=# vacuum full t8000_us_ts_size_test_2d;
VACUUM

pgdb001=# select pg_size_pretty(pg_total_relation_size('t8000_us_ts_size_test_2d'));
 pg_size_pretty
----------------
 12 MB

pgdb001=# truncate t8000_us_ts_size_test_2d;
TRUNCATE TABLE

pgdb001=# select pg_size_pretty(pg_total_relation_size('t8000_us_ts_size_test_2d'));
 pg_size_pretty
----------------
 16 kB


 


Don't miss a beat Get Messenger on your phone

pgsql-general by date:

Previous
From: "Carlo Stonebanks"
Date:
Subject: Windows build missing tcl "UNKNOWN" support
Next
From: Sylvain Lara
Date:
Subject: Select in temporary table