pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_stat_all_tables.last_vacuum not always correct.
2+ messages / 2 participants
[nested] [flat]

* pg_stat_all_tables.last_vacuum not always correct.
@ 2018-10-30 14:57  Kathleen Emerson <heavylivestock@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kathleen Emerson @ 2018-10-30 14:57 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

I ran `VACUUM VERBOSE` on 10-28. After the VACUUM completed, I ran the
query

`SELECT relname, last_vacuum FROM pg_stat_all_tables ORDER BY 2;`

This query returned:

         relname         |          last_vacuum
-------------------------+-------------------------------
 <table>                 | 2018-10-24 11:15:31.943684+00
 <table2>                | 2018-10-24 11:15:31.963803+00
 <table3>                | 2018-10-26 07:24:06.877427+00
 <table4>                | 2018-10-26 07:24:06.884089+00
 <table5>                | 2018-10-26 07:24:06.926874+00
 <table6>                | 2018-10-26 07:24:06.927982+00
...

I took some of these tables and grep'd the VERBOSE logs for them, getting
results like:

INFO:  vacuuming "<table>"
...
INFO:  "<table>": found 0 removable, 198 nonremovable row versions in 28
out of 104513 pages

INFO:  vacuuming "<table2>"
INFO:  index "<table2>" now contains 1816 row versions in 7 pages
INFO:  "<table2>": found 0 removable, 6 nonremovable row versions in 1 out
of 325 pages

INFO:  vacuuming "<table3>"
...
INFO:  "<table3>": found 0 removable, 1 nonremovable row versions in 1 out
of 10924 pages

INFO:  vacuuming "<table4>"
...
INFO:  "<table4>": found 0 removable, 21 nonremovable row versions in 4 out
of 4 pages

INFO:  vacuuming "<table5>"
INFO:  "<table5>": found 0 removable, 2 nonremovable row versions in 1 out
of 412 pages

INFO:  vacuuming "<table6>"
...
INFO:  "<table6>": found 0 removable, 0 nonremovable row versions in 0 out
of 0 pages


So, at least according to the VERBOSE logs, it seems like these tables
_were_ vacuumed. Why the discrepancy?

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pg_stat_all_tables.last_vacuum not always correct.
@ 2018-10-30 15:31  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Kathleen Emerson <heavylivestock@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-10-30 15:31 UTC (permalink / raw)
  To: Kathleen Emerson <heavylivestock@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Kathleen Emerson <heavylivestock@gmail.com> writes:
> I ran `VACUUM VERBOSE` on 10-28. After the VACUUM completed, I ran the
> query
> `SELECT relname, last_vacuum FROM pg_stat_all_tables ORDER BY 2;`
> [ and saw old timestamps for some ]
> So, at least according to the VERBOSE logs, it seems like these tables
> _were_ vacuumed. Why the discrepancy?

The pg_stats mechanism is designed to drop messages when under sufficient
load, so if there was a whole lot going on besides the VACUUM, maybe
that would explain it.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-10-30 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 14:57 pg_stat_all_tables.last_vacuum not always correct. Kathleen Emerson <heavylivestock@gmail.com>
2018-10-30 15:31 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox