Answer the question
In order to leave comments, you need to log in
How to optimize a query for a large amount of data?
There is a query that needs to be optimized for execution on a large amount of data.
SELECT PID FROM auto WHERE
PID NOT IN (SELECT DISTINCT auto_id FROM auto_in)
AND fk_id_client IN
(SELECT PID FROM client WHERE id_client IN
(SELECT id_client FROM client WHERE F_TYPE = 'BASE' GROUP BY id_client HAVING COUNT(*) >= 2))
Answer the question
In order to leave comments, you need to log in
Optimizing queries "by photo" is hopeless.
First of all, you need the same amount of data on which you can check.
But the general advice is to replace IN / NOT IN with joins / anti-joins.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question