GP - Report when vacuum was run last

SQL to report when vacuum was last run.

select

a.schemaname as "Schema",

a.objname as "Table",

to_char(statime, 'MM/DD/YYYY HH24:MI:SS') as "Last Vacuum"

from pg_stat_operations a

inner join information_schema.tables t

on a.schemaname = t.table_schema

and a.objname = t.table_name

left outer join pg_catalog.pg_partitions p

on t.table_schema = partitionschemaname

and t.table_name = partitiontablename

inner join (select n.nspname, r.relname, r.relstorage from

pg_catalog.pg_class r

inner join pg_catalog.pg_namespace n

on r.relnamespace = n.oid

) c

on t.table_schema = c.nspname

and t.table_name = c.relname

where

and a.actionname = 'VACUUM'

and t.table_type = 'BASE TABLE'

and t.table_schema not in ('pg_catalog','gp_toolkit')

and p.partitiontablename is null

and c.relstorage != 'x'

order by 1,3 desc

Comments

Popular posts from this blog

How to set Optimizer at database level in greenplum

Changing the gpmon Password

IPMI Tool | IPMI Cheatsheet