Is it possible to check the amount of reusable space available in a tablespace? before to run a VACUUM FULL on a large table?
I have a large postgres table (about 20G) that gets an occasional full vacuum. The free space available on this drive varies between 15 and 25 GB. Before attempting each aspiration, I record the size of the table (with the help of postgres queries) and the available disk space ( with the help of operating system tools).
I know that VACUUM FULL requires a complete copy of the table. So, if the table is 20G then 20G of free space are needed.
Sometimes the table will be 20G, there will only be 15G of available space and the vacuum will work. I guess the extra 5G needed is retrieved internally from the tablespace.
Other times, the void will fail because of lack of space. I guess on these occasions, the extra 5G required was not found in the tablespace.
I would like to be able to check that I have enough space for a FULL VACUUM beforehand, how can I do that? I know how big is the table, I know how much space is available for the operating system, but what I do not know, is how much recyclable space is available in the table space.