in reply to /^mod_perl/ && Persistent DBI

abaxaba,

I hate to throw cold water on your ideas but without some type of "across-request/in-memory" mechanism (ala mod_perl or fastcgi), persistence of dbh handles is quite near impossible (at least on *nix, I'm not sure about win32 or OS-X).

If you have to deal with a traditional CGI environment, (one request per process), serialization of your connection class is actually going to slow you down (overhead of serialize/deserialize plus the need to reconnect to the db).

That being said, there are still some techniques you can use. If you know you're going to have a large set of "the same" sql queries, you could offline bake the html and serve up static html. If you're script does a large number of similar sql calls, placeholders may help. Not all drivers or servers database servers truely support placeholders.

-derby

update: ++IlyaM for Re: /^mod_perl/ && Persistent DBI.