In Maybe Normalizing Isn’t Normal Jeff Atwood says, ‘You’re automatically measuring all the queries that flow through your software, right?’ I’m not but I’d like to.
Some features of the application in question:
- ASP.NET
- a data access layer which depends on the MS Enterprise Library Data Access Application Block
- MS SQL Server
In addition to Brad’s mention of SQL Profiler, if you want to do this in code, then all your database calls need to funnelled through a common library. You insert the timing code there, and voila, you know how long every query in your system takes.
A single point of entry to the database is a fairly standard feature of any ORM or database layer — or at least it has been in any project I’ve worked on so far!