patternsqlMinor
pg_relation_size does not show any difference after VACUUM ANALYZE
Viewed 0 times
aftershowvacuumanalyzeanydifferencedoesnotpg_relation_size
Problem
I wrote a script to backup a postgresql using
But both
COPY and then delete those records. I have used pg_relation_size before and after delete. - pg_relation_size
- DELETE
- VACUUM ANALYZE
- pg_relation_size
But both
pg_relation_size shows same results. Does this mean VACUUM ANALYZE was not helpful?Solution
VACUUM does not necessarily make unused space available to the filesystem, it merely makes the blocks re-usable for further INSERTs (or UPDATEs).
If I'm not mistaken the only way to also actively reduce the size on the file system would be a
Do you expect the table to not get any new rows or updates? Because if it will get new rows, then it doesn't really make sense to try to shrink the files phyiscally now if they are going to be increased again later due to new rows arriving.
If I'm not mistaken the only way to also actively reduce the size on the file system would be a
VACUUM FULL, but beware that needs an exclusive lock on the table(s).Do you expect the table to not get any new rows or updates? Because if it will get new rows, then it doesn't really make sense to try to shrink the files phyiscally now if they are going to be increased again later due to new rows arriving.
Context
StackExchange Database Administrators Q#16223, answer score: 5
Revisions (0)
No revisions yet.