Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faq vacuum messages #731

Merged
merged 5 commits into from
Apr 30, 2024
Merged

Faq vacuum messages #731

merged 5 commits into from
Apr 30, 2024

Conversation

TheVillageGuy
Copy link
Contributor

Add sql query to free up disk space after deleting messages

Add sql query to for freeing up disk space after deleting messages
small changes to my edit
@TheVillageGuy TheVillageGuy added the documentation Improvements or additions to documentation label Apr 27, 2024
@e-five256
Copy link
Member

e-five256 commented Apr 27, 2024

Realistically I'm not sure why the command does a DELETE FROM table rather than TRUNCATE table which frees disk space immediately (and also is instant, as it doesn't actually have to scan the table it's far faster)

TRUNCATE quickly removes all rows from a set of tables. It has the same effect as an unqualified DELETE on each table, but since it does not actually scan the tables it is faster. Furthermore, it reclaims disk space immediately, rather than requiring a subsequent VACUUM operation. This is most useful on large tables.

@e-five256
Copy link
Member

e-five256 commented Apr 27, 2024

I guess one is unqualified while the other, queue_name = dead, is not, so perhaps it's fine to leave as is and just call out what even the truncate docs mention, requires a vacuum to mark as freed

(There's a lot of finer details here in regards to how postgres marks space as free and what you have to do to actually return it to the OS, I don't want to super get into that but I think this is fine for now and people can always do more research reading the docs (specifically the "However, extra space is not returned to the operating system" section))

e-five256
e-five256 previously approved these changes Apr 27, 2024
melroy89
melroy89 previously approved these changes Apr 27, 2024
@melroy89 melroy89 dismissed stale reviews from e-five256 and themself via b540e4f April 30, 2024 09:34
@melroy89 melroy89 enabled auto-merge (squash) April 30, 2024 09:34
@melroy89 melroy89 merged commit 63753ff into main Apr 30, 2024
7 checks passed
@melroy89 melroy89 deleted the Faq-vacuum-messages branch April 30, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants