Re: [HACKERS] AutoVacuum Behaviour Question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Jeff Amiel <jamiel(at)istreamimaging(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Bruce McAlister <bruce(dot)mcalister(at)blueface(dot)ie>, General <pgsql-general(at)postgresql(dot)org>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] AutoVacuum Behaviour Question
Date: 2007-11-04 18:40:42
Message-ID: 16248.1194201642@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>>>> No, it isn't. Please add a TODO item about it:
>>>> * Prevent long-lived temp tables from causing frozen-Xid advancement
>>>> starvation
>>
> Jeff Amiel wrote:
>> Can somebody explain this one to me? because of our auditing technique, we
>> have many LONG lived temp tables.....(one per pooled connection)...so as
>> long as the pool isn't disturbed, these temp tables can exist for a long
>> time (weeks....months?)

> Hmm. The problem is that the system can't advance the frozen Xid for a
> database when there are temp tables that live for long periods of time.
> Autovacuum can't vacuum those tables; if the app vacuums them itself
> then there's no problem, but you can only vacuum them in the same
> session that creates it.

I'm not convinced there's a huge problem here. Surely Jeff's app is
going to either vacuum or truncate those temp tables occasionally;
otherwise they'll bloat to the point of uselessness. Either action
will fix the problem.

The real issue is that the app has to remember to do that. Perhaps
a better TODO item would be
* Find a way to autovacuum temp tables
though I admit I have no clue how to do that without giving up most
of the performance advantages of temp tables.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jesus Arocho 2007-11-04 20:52:51 Restore a database
Previous Message Dimitri Fontaine 2007-11-04 18:01:55 Re: COPY ... FROM and index usage

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-11-04 18:48:03 Re: Test lab
Previous Message Joshua D. Drake 2007-11-04 18:38:52 Re: Intel x64 vs AMD x64 pgdata