Hey all, I had some major issues with my company's site and didn't know why our site kept crashing. Well, the actual reason was something quite different, but as I was trying to debug I implemented this technique to help troubleshoot in the future.
The idea is to log all query calls to the dB to see which query takes an abnormal time to process. You can then look at the logfiles table to see the count.
<cfset gm_startTime = gettickcount()> <cfquery name="testQuery" datasource="#ds#"> select user_id, name, address, city, state, zip from users where user_id = '#url.user_id#' </cfquery> <cfset gm_endTime = gettickcount()> <cfset totalTime = (gm_endTime - gm_startTime)/1000> ... ... ... <cfquery name="logrecs" datasource="#ds#"> insert into LOGFILE(pagecall,starttime,endtime,totaltime,createdate,queryname) vales('page1.cfm',#gm_startTime#,#gm_endTime#,#totalTime#,getdate(),'testQuery') </cfquery>
Now if/when your site acts odd you can check this table first to see if the culprit is any query processing.