I am trying to extract duplicate rows from my database. I have a listings table and a listings_meta table which holds additional information. The listings_meta table has over 16,000 rows. When I run the query below it runs REALLY slow.
I don't understand why. Is there something wrong with my code?
SELECT l.id FROM listings AS l
LEFT JOIN listings_meta AS lm ON lm.listing_id = l.id AND lm.meta_key = 'email'
LEFT JOIN listings_meta AS lm2 ON lm2.listing_id = l.id AND lm2.meta_key = 'submitter_email'
WHERE lm.meta_value = '[email protected]' OR lm2.meta_value = '[email protected]' OR l.listing_title RLIKE 'Test'
GROUP BY l.id LIMIT 1
Are there certain things I can do to improve load time of large tables in general?