Following is my query.
SELECT * FROM t1 WHERE t1.record_id IN (
SELECT t2.record_id FROM t2
INNER JOIN t3 ON CONCAT(t2.case_number,t2.courtfile_type) = CONCAT(t3.case_number,t3.courtfile_type))
It contain IN
constraint which is taking lot of time to extract result from database.Database
is huge obviously.
How can I optimize this query?
Try this:
USING JOIN
USING EXISTS
Check the execution plan of the query using
EXPLAIN
keyword and do proper indexing on tables.