Postgres 10.3 : table grows in size after delete-insert
VACUUM will only shrink the data file if the free space happens to be at the end. What you probably want is a VACUUM FULL. However be aware of a couple of caveats:


It will lock the table while it runs (which may be a while)
It will require equivalent temporary space to the table


But when it is finished, the final space used will be just enough for the actual data you have.