I'm working on a largish webapp that was developed by several other programmers and I keep running into performance issues caused by poorly written SQL queries and queries that don't use an index.  I'm working on fixing the problems by logging how long each query takes to complete and if it's using an index.I was wondering if other people have had this problem before and what they've done to keep it from happening again.  My initial idea is to throw an exception if any query doesn't use an index so it has to be taken care of in devel but to continue to log the large/slow queries so we can see long term where the slowness is.Update 2012-03-05 11:56 EDTWe're using MySQL and my plan WAS to run explain on each query after it's run to check for indexs.
Throwing an Exception if a Query Doesn't Use an Index
performance;sql