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

Re: Prepared statements considered harmful

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Prepared statements considered harmful
Date: 2006-08-31 18:01:09
Message-ID: 200608312001.10245.peter_e@gmx.net (view raw or flat)
Thread:
Lists: pgsql-hackers
Gregory Stark wrote:
> Then you would be going very much against the user's expectations.
>
> Driver interfaces expose very clearly to the user an explicit
> interface to prepare and execute a query separately. What your
> proposing is to go behind the user's back and do what he's gone out
> of his way to tell you not to do. You can always choose to prepare
> your queries immediately before use. Most drivers even supply an
> interface to do so in a single step for convenience.

Let's verify that.  JDBC and PL/pgSQL have been mentioned.

The JDBC documentation merely contains statements of the sort "A SQL 
statement with or without IN parameters can be pre-compiled and stored 
in a PreparedStatement object. This object can then be used to 
efficiently execute this statement multiple times."  There is 
absolutely no indication that the execution plan of the statement is 
computed at the time of preparation.  In fact, it doesn't say 
what "pre-compiled" means at all.

For PL/pgSQL, you simply write a query and all the preparing action 
happens implicitly.  There is nothing explicit about that interface.

So if users have certain expectations here, they're just making them up.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2006-08-31 18:08:40
Subject: Re: Prepared statements considered harmful
Previous:From: Tom LaneDate: 2006-08-31 17:50:50
Subject: Re: [COMMITTERS] pgsql: Second try committing the path changes.

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