Try EXPLAIN SELECT metricID FROM metrics
WHERE metricID NOT IN
(SELECT metricID FROM metrics_custom_report WHERE processID='2.01' AND orgID='mydemo')
AND processID = '2.01'
From the look of it, your big query does two full table scans, builds a big temporary table, and and scans that.
NOT IN typically will cause a non-indexed search
I'll bet orgID isn't indexed
This join, by the way
LEFT OUTER JOIN metrics_custom_report mcr ON m.metricID = mcr.metricID
WHERE mcr.metricID IS NULL
looks to be a first-class backbreaker.
As a rule: Search FOR values, not around them.
If using a NOT IN, make the items explcit rather than using a dynamic subselect.
get the results from
SELECT metricID FROM metrics_custom_report WHERE processID='2.01' AND orgID='mydemo'
implode the results into a string
1,2,3,4 <<etc
then
WHERE NOT IN (1,2,3,4)
rather than WHERE NOT IN (SELECT metricID
that should work SIGNIFICANTLY faster.