Way to skip the iterations and database read from AFL

Hi Experts,

Below is what I am looking for.

Problem : I configured the database connection which stores date and time information in table, AFL keeps hitting the table which impacts performance. Its taking around 5 to 7 seconds to change the instrument / script to effect and show the chart. Below is my code snippet.

DiffEntry = odbcGetValueSQL("EXEC sp_Get_Actual_Signal_Time '" + Symbol2 + "','" + DateTimeFormat( dtformat, dt[i] ) + "','" + DateTimeFormat( tmformat, dt[i] ) + "','" + BuySell + "'");

Solution : What I thought was, if there is any way to control the iterations, that could help. I believe it is possible to do the same by validating the variable Length. I want to check, if any other way around. Please suggest.