Re: Prepared statements considered harmful

From: Gregory Stark <gsstark(at)mit(dot)edu>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Prepared statements considered harmful
Date: 2006-08-31 23:04:07
Message-ID: 87lkp45wyg.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:

> > 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.
>
> Is that really so? Under Perl DBI, the only way to get a statement
> handle is to "prepare" it.

Sure, but you can prepare it right before you use it and throw it away instead
of keeping it around.

The server has to prepare the query sometime. The v3 protocol just gives you
control over when that happens, but it doesn't force you to do it at any
particular time.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2006-08-31 23:25:51 Re: Win32 hard crash problem
Previous Message Tom Lane 2006-08-31 22:56:18 Re: Win32 hard crash problem