I have a postgres database with tablespaces spread over two disks. (one SSD disc for current data, one magnetic drive for older data)
Occasionally I move table partitions that contain 'old' data to the tablespace on the backup drive using....
ALTER TABLE..... SET TABLESPACE....
Sometimes the command will fail after a few minutes with a space warning. The source table may be (say) 30Gbytes, the disk the table is on may be down to it's last 5Gbytes of free space (according to windows) and the destination tablespace might have several hundred Gbytes free.
- Why is freespace required on the source disk - i.e. the disk the data is already on?
- Is there anyway of reducing (or removing) the requirement for freespace?
- Is there anyway of calculating how much free space is going to be required to allow the
SET TABLESPACEcommand to work?