At least on 9.3, PostgreSQL does not rewrite fields stored out of line in TOAST
tables if they are stored out of line. I don't know if that's true in 9.0.
You can see what storage is used for a column with \d+ tablename
; the storage
column shows the mode used. Individual tuples may be stored compressed in-line if they're small enough (ex: < 2K), even in an extended
storage column where tuples are eligible for out of line storage.
See the documentation for TOAST
and ALTER TABLE ... SET STORAGE
.
Temp files are stored in the temp_tablespaces
. By default this is empty, in which case it falls back to default_tablespace
, which in turn if empty falls back to the pg_default
tablespace.
Space within tables/indexes should be freed for re-use automatically by autovacuum. Make sure your autovacuum daemon is running often enough and doesn't have too much of a cost_delay set. Autovacuum has been significantly improved since 9.0.
If you want to free space back to the operating system or for use in other tables, you'll need to VACUUM FULL
or use an external tool like pg_repack
to do it in a less intrusive manner.