Carl (CBM) wrote:
I am getting a lot of emails about the following query
taking too long
and being killed on thyme:
SELECT ns_id, ns_name FROM toolserver.namespacename where (ns_type
= 'canonical' or ns_type = 'primary') and dbname = 'enwiki_p'
Some of these emails claim that query ran over 3000 seconds. This
particular query should be quite fast. Is something up with the db
I've had some issues recently with MySQL as well. My working theory is that
there have been (serious) regressions in recent point releases of MySQL,
particularly related to subqueries and subexpressions. I've had all sorts of
queries hanging (and even causing a pile-up leading to max_connections
errors) within the past few weeks.
Looking at your query, my first and best bet would be that it's the OR
clause that's causing you grief. I'd rewrite the query to be:
WHERE ns_type IN ('primary', 'canonical')
AND dbname = 'enwiki_p';
If the problem persists with a rewritten query, it'd be quite surprising.