Thread: when a table was last vacuumed

when a table was last vacuumed

From
AI Rumman
Date:

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

Re: when a table was last vacuumed

From
Guillaume Lelarge
Date:
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

Re: when a table was last vacuumed

From
AI Rumman
Date:
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:
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

Re: when a table was last vacuumed

From
Glyn Astill
Date:
--- 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';




Re: when a table was last vacuumed

From
Guillaume Lelarge
Date:
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