Skip site navigation (1) Skip section navigation (2)

DEALLOCATE ALL

From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: PGSQL-Patches <pgsql-patches(at)postgresql(dot)org>
Cc: "Andrzej Rusin" <Andrzej(dot)Rusin(at)interia(dot)pl>
Subject: DEALLOCATE ALL
Date: 2007-03-27 14:29:53
Message-ID: e51f66da0703270729n4726dd14s992f6a2ed2e351@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-patches
When pooling connections where prepared statements are in use,
it is hard to give new client totally clean connection as
there may be allocated statements that give errors when
new client starts preparing statements again.

Currently PgPool solves the situation by parsing all queries
and keeping list of prepares statements.  This may not be a big
problem for it as it parses the queries anyway, but for simple
pooler like PgBouncer (see pgfoundry) that does not look inside
libpq packets it is huge problem.

Attached is a patch that allows keyword ALL to be used with
DEALLOCATE and then frees all prepared queryes.  I think it is
useful for most pooling situations, not only PgBouncer.
Also its similar in the spirit to RESET ALL.

I did it slightly hacky way - if DeallocateStmt->name is
NULL is signifies DEALLOCATE ALL command.  All the code
that looks into DeallocateStmt seems to survive the situation
so it should be problem.  If still a new node is needed
or additional field in the node I can rework the patch.

-- 
marko

Attachment: dealloc_all.diff
Description: application/octet-stream (6.6 KB)

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2007-03-27 14:29:54
Subject: Re: Unbroke srcdir!=builddir compilation
Previous:From: Bruce MomjianDate: 2007-03-27 14:28:54
Subject: Re: Fast CLUSTER

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group