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:19] – [Table Bloat] 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; | ||
| </ | </ | ||
| Line 30: | Line 53: | ||
| This will create a new unfragmented table and rebuild all associated indexes.\\ | 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.\\ | 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:// | The basis of the below SQL query was taken from: [[https:// | ||
postgresqlvacuum.1632406782.txt.gz · Last modified: (external edit)
