-
I think I found a clue.
This SQL query is repeated multiple times per page requeat. What is probably causing issues is the fact we've now had 246 records (countries) loaded into memory or a hash - and then we only use one record from that hash to display some country data. But take that a step deeper, we're loading this table multiple times on each page load. Is that once per user that has their icon displayed on the screen? This is the only query that returns more than 12 records (my pagination value for most pages)... and it sticks out as an outlier. Cant this be cached, or at the very least, if we're going to query the table once per user, lets include the country in the query to improve performance?
EDIT: I spoke too soon. Thats only on the homepage. That query does not appear frequently on the discussions-home page request (which is slower). Still a possible optimisation opportunity, but something else causing issues.