I have been struggling with a problem that only happens when the database has been idle for a period of time for the data queried. The first query will be extremely slow, o
Is anything else running on your mysql server? My thought is that maybe after the first query, your table is still cached in memory. Once it's idle, another process is causing it to be de-cached. Just a guess though.
How much memory do you have any what else is running?