From: Karl O. P. <ko...@me...> - 2007-08-05 18:09:37
|
On 08/05/2007 12:22:12 PM, Lionel Bouton wrote: > Karl O. Pinc wrote the following on 05.08.2007 18:26 : > > Hi, > > > > So, I looked at the code. I'm not a perl wiz, > > but the problem appears to be obvious. Sqlgrey > > seems to be repeatedly creating prepared queries, > > each of which differs from the last. The whole > > point of prepared queries is to have _invariant_ > > queries, substituted parameters excepted. > > > > > > Not exactly. It's only a problem when you cache the prepared > statements. Thanks for looking at this. The DBI had also better be doing a "DEALLOCATE" when the prepared query goes out of scope, or else (in PostgreSQL) it won't get deallocated on the server side. I don't see the point in using prepared queries that are only executed once. That would only introduce extra overhead involved in the allocation and deallocation of the prepared queries. Which is, I suppose, what it is that you're looking into. :) (To be persnickity about it, the queries won't be optimized any better if you use prepared queries, but you eliminiate at least some sql parsing overhead (perhaps all depending on the api) and you eliminate the planner overhead -- which can amount to a lot.) I see what you mean about using prepare and not prepare_cached. You're right about my proposal not fixing memory leaks. But I've a gut feeling that it will work-around the memory leaks, which I'm guessing have to do with preparing a lot of unique statements. Let me know if you need someone to test something. Karl <ko...@me...> Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein |