agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: jim_yates <pg@wg5jim.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: could not access status of transaction pg_multixact issue
Date: Thu, 9 Oct 2014 12:12:30 -0300
Message-ID: <20141009151229.GD7043@eldon.alvh.no-ip.org> (raw)
In-Reply-To: <5436A34C.8090306@aklaver.com>
References: <1412791213607-5822248.post@n5.nabble.com>
<20141008185538.GY7043@eldon.alvh.no-ip.org>
<1412797415000-5822268.post@n5.nabble.com>
<20141008205416.GZ7043@eldon.alvh.no-ip.org>
<1412863620263-5822376.post@n5.nabble.com>
<5436A34C.8090306@aklaver.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Adrian Klaver wrote:
> On 10/09/2014 07:07 AM, jim_yates wrote:
> >Alvaro Herrera-9 wrote
> >>jim_yates wrote:
> >>
> >>>>A better way not involving mxid_age() would be to use pg_controldata to
> >>>>extract the current value of the mxid counter, then subtract the
> >>>current
> >>>>relminmxid from that value.
> >>>
> >>>
> >>>It's not clear which lines from pg_controldata to use for updating
> >>>pg_database.datminmxid.
> >>
> >>The one labelled NextMultiXactId.
> >>
> >>>I also assume I would do the pg_database update on a idle database.
> >>
> >>It doesn't matter, actually. pg_database is a shared catalog, so an
> >>update would affect all the databases.
> >>
> >>--
> >>Álvaro Herrera http://www.2ndQuadrant.com/
> >>PostgreSQL Development, 24x7 Support, Training & Services
> >
> >I tried doing the update to pg_database on my Dev server and I can't get it
> >to work. How do I calculate the new datminmxid value?
> >
> >NextMultiXactId: 30349 relminmxid from pg_class for the table: 8376
> >
> >If I subtract the relminmxid from the nextmulixact I get 21793 which won't
> >work.
> >
> >production-copy=# update pg_database set datminmxid=21973 where
> >datname='production-copy';
> >ERROR: column "datminmxid" is of type xid but expression is of type integer
>
> Casting issue, try:
>
> update pg_database set datminmxid='21973' where
> datname='production-copy';
There must have been some confusion somewhere; certainly you shouldn't
be subtracting anything. The subtraction was just suggested as a way to
determine the age. The value to update pg_database.datminmxid to is the
oldest one of all the relminmxid in pg_class; so if you have 8376 as the
minimum value there, that's what you set pg_database.datminmxid to. Not
the 21973 value.
update pg_database set datminmxid='8376' where datname='production-copy';
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (16+ messages) latest in thread
Message-ID: <20141009151229.GD7043@eldon.alvh.no-ip.org>
Permalink: ../20141009151229.GD7043@eldon.alvh.no-ip.org/
Also on: postgresql.org/message-id/20141009151229.GD7043@eldon.alvh.no-ip.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: alvherre@2ndquadrant.com, adrian.klaver@aklaver.com, pg@wg5jim.net
Subject: Re: could not access status of transaction pg_multixact issue
In-Reply-To: <20141009151229.GD7043@eldon.alvh.no-ip.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox