when a table was last vacuumed

Started by AI Rummanabout 16 years ago5 messagesgeneral
Jump to latest
#1AI Rumman
rummandba@gmail.com

If it possible to find out when a table was last vacuumed?

#2Guillaume Lelarge
guillaume@lelarge.info
In reply to: AI Rumman (#1)
Re: when a table was last vacuumed

Le 10/02/2010 10:48, AI Rumman a �crit :

If it possible to find out when a table was last vacuumed?

SELECT schemaname, relname, last_vacuum, last_autovacuum
FROM pg_stat_all_tables;

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com

#3AI Rumman
rummandba@gmail.com
In reply to: Guillaume Lelarge (#2)
Re: when a table was last vacuumed

But I am using Postgresql 8.1 and here no clumn named last_vacuum.

On Wed, Feb 10, 2010 at 4:12 PM, Guillaume Lelarge
<guillaume@lelarge.info>wrote:

Show quoted text

Le 10/02/2010 10:48, AI Rumman a écrit :

If it possible to find out when a table was last vacuumed?

SELECT schemaname, relname, last_vacuum, last_autovacuum
FROM pg_stat_all_tables;

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com

#4Glyn Astill
glynastill@yahoo.co.uk
In reply to: AI Rumman (#1)
Re: when a table was last vacuumed
--- On Wed, 10/2/10, AI Rumman <rummandba@gmail.com> wrote:

If it possible to find out when a table
was last vacuumed?

Try:

select pg_stat_get_last_vacuum_time(oid) from "pg_catalog".pg_class where relname = 'tablename';

select pg_stat_get_last_autovacuum_time(oid) from "pg_catalog".pg_class where relname = 'tablename';

#5Guillaume Lelarge
guillaume@lelarge.info
In reply to: AI Rumman (#3)
Re: when a table was last vacuumed

Le 10/02/2010 11:23, AI Rumman a �crit :

But I am using Postgresql 8.1 and here no clumn named last_vacuum.

On this old release, the only way you can find such an information is
via the logfile and using DEBUG1 or DEBUG2 level. Not something I would
recommend for a production server.

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com