We run Postgres 9.0 on Windows 2008 Server. There is a large table contains a bytea
column for storing binary data ranging from 0-5MB in each row:
CREATE TABLE files
(
file_id serial NOT NULL,
data bytea NOT NULL,
on_disk boolean,
CONSTRAINT files_pkey PRIMARY KEY (file_id)
)
Recently we have been updating the on_disk field for each row (not touching the data field). We believe this has eaten up space in our temp tablespace (or something), for two reasons:
1) We started receiving this error in other random parts of the system running large queries:
ERROR: 53100: could not write block 92271 of temporary file
2) Our free space dropped from ~7GB to 1.5GB within a week which is uncharacteristic.
Can anyone confirm:
a) Will updating a row in postgres cause it rewrite the ENTIRE row (including large binary data) without freeing up the old space? This would explain our symptoms
b) Is it writing to some other temporary tablespace during the change which also uses up space? (Can we force freeing up the temp space?)
c) Is there a way we can perform minor boolean field updates to this table WITHOUT rewriting the row (&chewing up diskspace) each time?
d) Can we force postgres periodically to free up the used space without rewriting the entire table?? (Our known methods for freeing up the space involve a table rewrite which we don't have the space for)
P.S.: Yes we are migrating our server to a host with a larger storage space... this may be 1-2 months away.