Problem summery: ----------------------- Simple queries sometimes take ~400 ms Analysis: ----------- - A php script runs the same SQL query several times in different places (in different transactions). Some of the queries take around 400ms while the others (identical queries) takes only 4-20ms. (The timings are consistent for the same php script.) - Testing showed that when adding multiple identical queries after a "problematic" query run very fast, I.e.: ... - time measurement is done with explode(' ', microtime()); Test script: --------------- A Test script shows that the first query take long time, but the others are quick. It happens also not in the first query, but we don't have a simple test script that reproduces that yet. Script output: <p>DB is sqlite:/usr/local/web/443/lbaProvDB<p>oneOpenTest: <br> 0.66058707 SELECT * FROM MediaGateway <br> 0.00106287 SELECT * FROM MediaGateway <br> 0.00017715 SELECT * FROM MediaGateway <br> 0.12085819 SELECT * FROM GeneralPlatformProperties <br> 0.00016093 SELECT * FROM GeneralPlatformProperties WHERE 1 <br> 0.0649929 SELECT * FROM ClassOfRestriction WHERE id IS NULL <br> 0.05895591 SELECT * FROM ClassOfRestriction <br> 0.05869102 SELECT * From BriefHuntGroupList ORDER BY huntGroupName COLLATE NOCASE Second run: <br> 0.04814911 SELECT * FROM MediaGateway <br> 0.00015306 SELECT * FROM MediaGateway <br> 0.00019789 SELECT * FROM MediaGateway <br> 0.00516605 SELECT * FROM GeneralPlatformProperties <br> 0.000175 SELECT * FROM GeneralPlatformProperties WHERE 1 <br> 0.02837396 SELECT * FROM ClassOfRestriction WHERE id IS NULL <br> 0.00037098 SELECT * FROM ClassOfRestriction <br> 0.05728984 SELECT * From BriefHuntGroupList ORDER BY huntGroupName COLLATE NOCASE
Questrions: ------------------- What can explain the long procces time for the first query? What can explain log proccessing time for queries whic are not the first ? Thanks, Erez.