Thread: Vacuuming and template0

Vacuuming and template0

From
Alexander Stanier
Date:
We vacuum our live database every night. Recently we then got a message
saying that we should vacuum "template1", "postgres" and "mp_base" or
the server would shut down. I now understand this is necessary to guard
against transaction wrap around and we did the full vacuum on these
databases straight away. The message has now gone away. We did not,
however, vacuum template0 and I notice that the age on this database is
now negative:

mp_live=# select datname, datvacuumxid, datfrozenxid, age(datfrozenxid)
from pg_database;
  datname  | datvacuumxid | datfrozenxid |     age
-----------+--------------+--------------+-------------
 postgres  |   2140511881 |   1070040079 |  1078428152
 mp_live   |   2140510678 |   1066768855 |  1081699376
 template1 |   2140511881 |   1070047126 |  1078421105
 template0 |          499 |          499 | -2146499564
 mp_base   |   2140511881 |   1070049511 |  1078418720
(5 rows)

Should we attempt to vacuum template0? I read a note somewhere saying
that you can't vacuum template0 and don't need to. Is this correct?

Are there any consequences of the XID for template0 wrapping round and
the "age" becoming negative?

The system seems to be running normally. We are running PostgreSQL
8.1.11 on Redhat 5.1.

Thank you in advance for any advice.

Regards,

--
Alex Stanier

E-Government Solutions Ltd
Email: alexander.stanier@egsgroup.com
www.egsgroup.com



This message has been scanned for malware by SurfControl plc. www.surfcontrol.com

Re: Vacuuming and template0

From
Tom Lane
Date:
Alexander Stanier <alexander.stanier@egsgroup.com> writes:
> Should we attempt to vacuum template0? I read a note somewhere saying
> that you can't vacuum template0 and don't need to. Is this correct?

No; yes.  template0 was frozen when it was made.

            regards, tom lane