On Friday, January 3, 2003, 12:08:23 AM, Tom wrote:

> On Thursday 02 January 2003 05:53 am, Gavin Sinclair wrote:
>> I doubt if that SQL will actually work, since it is many statements,
>> and I'd bet $250 that DBI will only allow one statement at a time.
>> The smart money is on:
>>    [code snipped]
>> i.e. a prepared statement will let you handle multiple statements
>> gracefully, and more efficiently (depending on DB) than sending
>> boatloads of hardcoded SQL at it.

> gavin, i'll take that bet! :-)
> [transami won :( ]

> really think prep'd statements are more efficient? do they really do anything 
> special? i thought they just did a gsub before sending off the sql, nothing 
> more.

I definitely think they're more efficient *in some DBs*.  In Oracle,
the statement is compiled internally.  The prepared statement is a
database reosurce.  For one or two statements, it's probably the same
or worse, but for 100+, I reckon PSs would fly.  Let us know the
results of your tests.

(I'd be surprised if PostgreSQL didn't support them.)

Even if it wasn't more efficient, it's a nice way to program.

> well, maybe i'll throw a quck test together. not much for profiling, but it 
> shouldn't be too hard. just two big long repretitve scripts and a watch.

Again, let us know.

Gavin