When I'm running a query for the first time, it takes x miliseconds to be executed. When I run it the second time it takes a lot less time. I assume that it is some caching involved in this mechanism, but I need to know what is the real speed of my queries.
- Can I reset the caching after the query instruction, or something like that?
- In the developement stage, what are you using to see the speed of your queries?
- Can you provide me a useful resource/tool/tutorial/blog to read about this thing/feature/problem?
BTW I'm using Apache, MySQL and PHP in Windows (XAMPP).
Personally, I tend to use the 2nd and subsequent executions as my benchmark when developing hence this answer...
Arguably the real speed is with caching of data and execution plan.
If it's run often enough to matter, then it will be cached in real life. You are measuring performance the 2nd time. For the first run, you're measuring load/compile times.
On a production server data will be cached too because of use, but on development it won't be.
It it's run once a day or as an occasional report then it doesn't matter (within reason).Tweet