FE/BE protocol vs. parameterized queries

From: Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: FE/BE protocol vs. parameterized queries
Date: 2006-09-04 21:07:12
Message-ID: slrnefp5c0.2ea3.andrew+nonews@atlantis.supernews.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Picking out a specific point from the thread on prepared queries:

Currently, the handling of Parse/Bind on the unnamed statement seems to
go like this:

- Parse on the unnamed statement does analysis and rewriting but does
not plan, storing the query in a special memory context dedicated to
the unnamed statement

- Bind on the unnamed statement plans the query (using the supplied
parameters) and stores the plan back in the unnamed statement's context

I believe this could usefully (and transparently to clients) be changed
so that Bind on the unnamed statement does _not_ store the plan back in
the unnamed statement's context, but instead produces a plan which is
only used _for that specific portal_. Thus, it would promote the parameters
to constants before planning, knowing that the plan could only be run once;
this would, I believe, allow the planner to produce a plan that was
equivalent to that of a non-parameterized query.

This would hopefully remove all cases where it is currently necessary to
use PQexec rather than PQexecParams, such as where parameterized limits,
immutable functions of parameters, partial indexes etc. are involved.

--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-09-04 21:23:37 Re: Have psql show current sequnce values -
Previous Message Bruce Momjian 2006-09-04 21:04:04 Re: Information_schema fixes for sequences and