Re: Prepared statements considered harmful - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Prepared statements considered harmful
Date
Msg-id 200608312001.10245.peter_e@gmx.net
Whole thread Raw
In response to Re: Prepared statements considered harmful  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Prepared statements considered harmful
Re: Prepared statements considered harmful
Re: Prepared statements considered harmful
List 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/


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Second try committing the path changes.
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Prepared statements considered harmful