Square1;10992153 wrote:
The FIRST time I go a page with a MySQL query it takes forever to load. When I refresh, it is fine.
This does sound like a possible cache issue, but it might be something else as well. I would still run EXPLAIN on the queries involved and see if you are missing an index, could provide compound indices (multiple column indexes), if restructuring the query would help or if you could perform ordering on a result set with as few columns as possible before joining in all columns you to avoid file sort.
This is pure speculation, but I believe the same query is likely to produce the same execution plan in MS SQL and MySQL. Still it's entirely possible, perhaps even likely, that some queries will produce different execution plans since the DBMSs do not share the same optimization code. Thus, one query might be more efficient in one DBMS while another is more efficient in the other DBMS, or one DBMS might always be more efficient.
Square1;10992153 wrote:
If I wait 3 minutes or so and then refresh, the problem returns and it takes forever
If this happens without other intermittent page requests, thus without other queries being executed, by you or other users, a cached query would not have expired (afaik). Thus, the issue would not be caching, but something else.
Square1;10992153 wrote:
It sounds like a cache issue. Where do I start to tackle this
Not only do I lack the expertise to help out in this regard, but I've heard experts in the area say that giving general answers to configuration options from an optimization perspective is impossible since it all depends on what queries you execute, how often, how many differnet queries you execute, what the mix between selects and inserts/updates there are etc. In one case we actually improved performance by disabling the query cache entirely.
Square1;10992153 wrote:
Is this a PHP cache issue?
Not if it's related specifically to the DB. However, caching things outside the DB can still be a good idea and give you performance gains. Memcached does an excellent job for some stuff. Still, considering your problem description, I'd say you have issues with the DB that needs solving, regardless of wether using other caching techniques would help or not.
Square1;10992153 wrote:
Is it a connectivity issue to MySQL? Any direction on this is appreciated!
I'd give the MySQL forums a go. You are more likely to get the help you need there since this seems to be problems related directly to MySQL, and you are more likely to find people with expertise in MySQL there than you are here.