I need some help cutting the execution time on this query. 7 seconds seems too long for a table with 1500 rows.
SELECT parent
FROM video
WHERE parent NOT IN (SELECT parent
FROM video
WHERE filename REGEXP '(s[0-9]{2}\e[0-9]{2})|([[:<:]][0-9]{3}[[:>:]])')
GROUP BY parent
First, you can use
NOT REGEXPinstead of a subquery.When using
REGEXPorNOT REGEXP, the indexes don’t matter. To make it more efficient, if that’s still not enough, you’ll have to look at using other string functions or theLIKEoperator.