On Sat, Jun 17, 2006 at 02:17:49AM -0700, Aaron Stone wrote:
> On Sat, 2006-06-17 at 04:30 -0400, Matthew T. O'Connor wrote:
> > Paul J Stevens wrote:
> > > Blake Mitchell wrote:
> > >   
> > >> Is there appreciable overhead in just preparing each statement as it's
> > >> built and only using it once? 
> > >>     
> > > I guess we pretty much have to assume the penalty might be a potential 
> > > DOS.
> > 
> > 
> > What penalty are we talking about here?  The cost of preparring a 
> > statement already exists.  The DB server already has to parse the SQL 
> > and plan the query, it's just that right now it doesn't keep that plan 
> > around.   So, if that is the cost you are talking about, it's a non-issue. 
> 
> I suspect that none of us knows the actual cost of creating a prepared
> statement. There's no reason to believe that the planning costs more or
> less vs. simply issuing a query in the ordinary way. Let's get a quick
> benchmark together so that we can find out if the overhead of preparing
> a query for only a single use is worthwhile or not.

The cost is essentially the same, minus the added round-trips to the
database.

In any case, I fail to see how this is an issue: if you're using
dynamically generated code in performance critical areas of the server
you have bigger things to worry about than the overhead of prepared
statements.
-- 
Jim C. Nasby, Database Architect                [EMAIL PROTECTED] 
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

Reply via email to