Answer the question
In order to leave comments, you need to log in
How to optimize the fetch from the database?
Can someone help me optimize this query:
SELECT q.id
FROM questions.question q
WHERE
NOT EXISTS (SELECT qt.question_id FROM questions.question_translate_it qt WHERE q.id = qt.question_id)
AND
NOT EXISTS (SELECT true FROM questions.translate_questions tq WHERE q.id = tq.question_id AND tq.language_id = 8)
LIMIT 1;
Answer the question
In order to leave comments, you need to log in
SELECT q.id
FROM questions.question q
LEFT JOIN questions.question_translate_it qt ON q.id = qt.question_id
LEFT JOIN questions.translate_questions tq ON q.id = tq.question_id
AND tq.language_id = 8
WHERE qt.question_id IS NULL
WHERE tq.question_id IS NULL;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question