Comment your SQL queries to track down performance hogs!
Posted by jrotenstein on December 3, 2009
Here’s a tip…
Start your SQL queries with a comment that uniquely identifies the query or its source. For example, I put lots of SQL queries on wiki pages, so I include the Unique ID of the wiki page:
-- Page 19323 select id from customer where ...
Then if the SQL Query runs wild, I can check the commands running on my server and the Page ID is visible at the start of the query. I can then track down the bad SQL!
Advertisement