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

Re: Prepared statements considered harmful

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>,Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Prepared statements considered harmful
Date: 2006-08-31 18:53:25
Message-ID: 20060831185325.GJ27851@svana.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Thu, Aug 31, 2006 at 02:16:32PM -0400, Andrew Dunstan wrote:
> According to the docs you can actually choose between server side 
> prepare or not on a per call basis. It contains this example:

Yeah, but it also contains this:

    Using prepared statements is in theory quite a bit faster: not only
    does the PostgreSQL backend only have to prepare the query only
    once, but DBD::Pg no longer has to worry about quoting each value
    before sending it to the server.

Which just continues the misconception: you can not worry about quoting
each value and still not use server-side prepares. There's a third
option which is not made clear (and it's not clear if it's available
via DBI).

Basically, unnamed "prepares" are not planned until bind time, named
statements are planned at prepare time. The question is, do you want to
be able to defer planning for named statements also?

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

pgsql-hackers by date

Next:From: Jeff DavisDate: 2006-08-31 18:55:44
Subject: Re: Prepared statements considered harmful
Previous:From: Joshua D. DrakeDate: 2006-08-31 18:51:54
Subject: Re: Thought provoking piece on NetBSD

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