I think my question is if I drop constraints and or indices can that space be used by a vacuum full?
However I don't really know enough to be sure that's the right question.
I have a Heroku managed DB, it has allocated storage of 768GB
I am using ~500GB(there's a big full vacuum running it'll be clearer after that)
Leaving ~268GB available (edit: vacuum is done I actually have 289GB free)
There is this other table that is getting a diet, it has:
- pg_relation_size = 274GB
- pg_table_size = 283GB
- pg_indexes_size = 74GB
- pg_total_relation_size = 357GB
I'm going to drop the column that is producing most of the toast (moving the data to S3) and two of the FK's which show in \d
as having indicies and constraints.
I'm looking at how can I full vacuum this thing afterward. (I will do regular vacuum first)
My understanding of full vacuum is basically it makes a whole other copy.
If my changes get the pg_total_relation_size under the ~268GB free space then presumably I'm good. But that seems unlikely.
So I'm wondering if the full vacuum can use any of the space that gets marked as reusable by the regular vacuum, if so there might be enough room anyway.
So will the vacuum be able to make use of the space freed up by any of the above?
Is there anywhere else I should look for freeing up some space?
Also is there anyway to know in advance if I'm going to have enough space for the full vacuum?
Of course my fall back plan is to eat the time and cost for moving the whole thing to a bigger database plan, vacuuming it and then moving it back.
edit: what if I drop all the indicies and constraints, full vacuum and then add them back?
then the "copy" doesn't need space for those
btw I'm able to shut down all access to this table for a day or two if need be, hence my ability to full vacuum it