Free space of toasted content 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.
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:


  To perform a full-table repack, pg_repack will:
  
  
  create a log table to record changes made to the original table
  add a trigger onto the original table, logging INSERTs, UPDATEs and DELETEs into our log table
  create a new table containing all the rows in the old table
  build indexes on this new table
  apply all changes which have accrued in the log table to the new table
  swap the tables, including indexes and toast tables, using the system catalogs
  drop the original table
  


It still needs enough space for the original table and the new copy.