postgresqlvacuum
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
postgresqlvacuum [2021/09/23 14:15] – z0hpvk | postgresqlvacuum [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 24: | Line 24: | ||
where n_live_tup > 0 | where n_live_tup > 0 | ||
order by 5 desc limit 10; | order by 5 desc limit 10; | ||
+ | </ | ||
+ | |||
+ | ==== Vacuum Progress ==== | ||
+ | Will not display the progress of VACUUM FULL commands. | ||
+ | <code SQL> | ||
+ | SELECT p.pid, now() - a.xact_start AS duration, | ||
+ | | ||
+ | CASE | ||
+ | WHEN a.query ~*' | ||
+ | WHEN a.query ~*' | ||
+ | ELSE ' | ||
+ | END AS mode, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | FROM pg_stat_progress_vacuum p | ||
+ | JOIN pg_stat_activity a using (pid) | ||
+ | ORDER BY now() - a.xact_start DESC; | ||
</ | </ | ||
==== Table Bloat ==== | ==== Table Bloat ==== | ||
+ | Table bloat can be fixed by performing a " | ||
+ | This will create a new unfragmented table and rebuild all associated indexes.\\ | ||
+ | However this will cause a full lock on the table, even SELECT queries will have to wait for the process to complete.\\ | ||
+ | Instead you can use the extension [[https:// | ||
+ | |||
+ | The basis of the below SQL query was taken from: [[https:// | ||
+ | |||
<code SQL> | <code SQL> | ||
SELECT current_database(), | SELECT current_database(), |
postgresqlvacuum.1632406556.txt.gz · Last modified: 2025/03/08 22:23 (external edit)