pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ed Loehr <eloehr@austin.rr.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Vacuum Question
Date: Tue, 06 Jun 2000 03:18:04 -0400
Message-ID: <22661.960275884@sss.pgh.pa.us> (raw)
In-Reply-To: <393C9639.639975A@austin.rr.com>
References: <20000601091701.631.qmail@mail01.edsamail.com.ph>
	<13854.959924635@sss.pgh.pa.us>
	<3937C85E.88ADA7EC@austin.rr.com>
	<14982.959958663@sss.pgh.pa.us>
	<393C94A7.AC0F4642@austin.rr.com>
	<393C9639.639975A@austin.rr.com>

Ed Loehr <eloehr@austin.rr.com> writes:
>> Then, start this one in another bash window/terminal/whatever...
>> 
>> % while test 1; do echo -n "`date`: "; psql -d pdb -c "vacuum analyze;
>> select count(*) from foo;"; sleep 3; done
>> 
>> This seems to consistently crash after the first vacuum with the
>> following message:

This is a known gotcha that's got nothing to do with any sort of
concurrency.  You can't safely send a VACUUM followed by anything
else in a single query string.  The problem is that VACUUM forces a
transaction commit, which releases all transiently allocated memory
in its backend ... including the already-parsed querytrees for the
rest of the query string.  Oops.  (cf. comment near line 560 in
src/backend/tcop/postgres.c)

You won't see the problem if you enter "vacuum analyze; select ..."
interactively or as a script in psql, because it chops up the
commands into separate query submittals.  But apparently psql
doesn't chop up a -c string.  Non-psql frontends can expose the bug
as well.

It's possible that this will get cleaned up as a byproduct of the
proposed rework of transaction-local memory contexts.  But it's
not a real high-priority problem, at least not IMHO.  For now,
the answer is "if it hurts, don't do it ;-)"

			regards, tom lane



view thread (33+ messages)  latest in thread

Message-ID: <22661.960275884@sss.pgh.pa.us>
Permalink:  ../22661.960275884@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22661.960275884@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, eloehr@austin.rr.com
  Subject: Re: Vacuum Question
  In-Reply-To: <22661.960275884@sss.pgh.pa.us>
  References: <20000601091701.631.qmail@mail01.edsamail.com.ph> <13854.959924635@sss.pgh.pa.us> <3937C85E.88ADA7EC@austin.rr.com> <14982.959958663@sss.pgh.pa.us> <393C94A7.AC0F4642@austin.rr.com> <393C9639.639975A@austin.rr.com> <22661.960275884@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox