Re: Reaping Temp tables to avoid XID wraparound

From: James Sewell <james(dot)sewell(at)jirotech(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reaping Temp tables to avoid XID wraparound
Date: 2019-02-13 23:00:01
Message-ID: CAANVwEuhh2cNr=TkY2fX=4WzjYr5c-C_FrCVZ2oK3VHkOUODsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It's easy to identify the temp tables which are causing the problem, yes.
The issue here is just getting rid of them.

In an ideal world I wouldn't actually have to care about the session and I
could just drop the table (or vacuum the table?).

Dropping the session was just the best way I could find to currently solve
the problem.

Cheers,

James Sewell,

Suite 112, Jones Bay Wharf, 26-32 Pirrama Road, Pyrmont NSW 2009
*P *(+61) 2 8099 9000 <(+61)%202%208099%209000> *W* www.jirotech.com *F *
(+61) 2 8099 9099 <(+61)%202%208099%209000>

On Thu, 14 Feb 2019 at 04:09, Magnus Hagander <magnus(at)hagander(dot)net> wrote:

> On Wed, Feb 13, 2019 at 6:05 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> > And while at it, what would in this particular case have been even more
>> > useful to the OP would be to actually identify that there is a temp
>> table
>> > *and which xid it's blocking at*. For regular transactions we can look
>> at
>> > backend_xid, but IIRC that doesn't work for temp tables (unless they are
>> > inside a transaction). Maybe we can find a way to expose that type of
>> > relevant information at a similar level while poking around that code?
>>
>> Maybe I'm confused, but doesn't the table's pg_class row tell you what
>> you need to know? You can't look inside another session's temp table,
>> but you don't need to.
>>
>
> I believe it does, yes.
>
> But that doesn't make for a way to conveniently go "what is it that's
> causing waparound problems", since due to pg_class being per database, you
> have to loop over all your databases to find that query. Having that
> information available in a way that's easy for monitoring to get at (much
> as the backend_xid field in pg_stat_activity can help you wrt general
> snapshots) would be useful.
>
> --
> Magnus Hagander
> Me: https://www.hagander.net/ <http://www.hagander.net/>
> Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>
>

--
The contents of this email are confidential and may be subject to legal or
professional privilege and copyright. No representation is made that this
email is free of viruses or other defects. If you have received this
communication in error, you may not copy or distribute any part of it or
otherwise disclose its contents to anyone. Please advise the sender of your
incorrect receipt of this correspondence.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-02-13 23:17:09 Re: Using POPCNT and other advanced bit manipulation instructions
Previous Message Andrew Gierth 2019-02-13 22:56:04 proposal: pg_restore --convert-to-text