in reply to Replacing SQL with perl

Well, lets us assume you are working with a "serious" RDBMS (by that I mean Oracle, Informix or DB/2 - those where the engine is the result of substantial development work over many years). If performance is key, do as much in the engine as possible. That means, all that good SQL stuff, sorted procedures, triggers and so on.

A good dba will look at the application requirements, and make sure there are the correct indexes across the whole database. Database optimisers (like those used in the above mentioned databases) are normally very good at squeezing the last bit of performance out of the engine and the hardware. After all, that to a large degree is what you are paying for - the top end performance.