That is called a "stored procedure". But, if it is DB-neutral, what are you sending to the DB itself? Not SQL?You still have the call to the stored procedure to parse. What many caching query libraries do is create a transient stored procedure transparently, then use it with supplied parameters whenever that query is called again. This portion depends on the facilities of the underlying database, which, I would point out, I don't have to worry about because I'm using a mapping layer. I get as much caching as can be supported without any changes, no matter what back end is doing the work.