Autovacuum vacuums not setting start time in pg_stat_activity

Started by Jim Nasbyalmost 19 years ago4 messagesbugs
Jump to latest
#1Jim Nasby
Jim.Nasby@BlueTreble.com

This is on a 8.2.3 database; vacuums started by autovacuum don't get
their query_start time set.

select * from pg_stat_activity where current_query like 'VACUUM%';
-[ RECORD 1 ]-+---------------------------------------------
datid | 16384
datname | emma2
procpid | 8674
usesysid | 10
usename | postgres
current_query | VACUUM public.userdata_2409_messages_history
waiting | f
query_start |
backend_start | 2007-06-12 15:29:53.376641-05
client_addr |
client_port |

--
Jim Nasby jim.nasby@enterprisedb.com
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jim Nasby (#1)
Re: Autovacuum vacuums not setting start time in pg_stat_activity

"Jim Nasby" <jim.nasby@enterprisedb.com> writes:

This is on a 8.2.3 database; vacuums started by autovacuum don't get
their query_start time set.

Hmm. Query_start is actually defined as "time of last client command
receipt", so it's null just like client_addr/port are. Not sure if
there's anything we should put there that's more meaningful than the
backend start time.

regards, tom lane

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#2)
Re: Autovacuum vacuums not setting start time in pg_stat_activity

Tom Lane wrote:

"Jim Nasby" <jim.nasby@enterprisedb.com> writes:

This is on a 8.2.3 database; vacuums started by autovacuum don't get
their query_start time set.

Hmm. Query_start is actually defined as "time of last client command
receipt", so it's null just like client_addr/port are. Not sure if
there's anything we should put there that's more meaningful than the
backend start time.

Let's put the current command (vacuum/analyze) start time in there.
Backend start time, I assume, is the time at which the current autovac
iteration was started.

Should this be backpatched if changed in 8.3?

--
Alvaro Herrera Developer, http://www.PostgreSQL.org/
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#3)
Re: Autovacuum vacuums not setting start time in pg_stat_activity

Alvaro Herrera <alvherre@commandprompt.com> writes:

Should this be backpatched if changed in 8.3?

I'd vote no; it's pretty hard to argue that it's a bug fix
as opposed to a cosmetic improvement.

regards, tom lane