I have just deleted a big part of the data stored in one jsonb inside my users table (Its not needed anymore) and just keep an id inside that column. I expected to free a lot of disk space with this action.
UPDATE users SET my_jsonb = '{id: xxxx }';
The problem is that when i try to see the free space in the disk remains the same
/dev/md125 935G 501G 387G 57%
Also the table
Table Size External
users | 497 GB | 478 GB
My last option is to try a VACUUM FULL users
but since this table is used in production environment it would not be convenient to lock it a unkown ammount of time.
Im running a postgres 10.5 database on a CENTOS RHEL7 machine.
Best Answer
A plain VACUUM will make the free space available for new data (i.e., other TOASTed JSON data).
If you really want to give the free space back to the OS, and you cannot afford the exclusive lock, try pg_repack:
It still needs enough space for the original table and the new copy.