I have a MySQL table which is described in the following question.Counting number of ids present in one table which is not presented on another for a particular userThe query which I am using is as follows.
SELECT count(*) coincidencesFROM table1WHERE user_id = 12AND NOT EXISTS (SELECT 1 FROM table2 WHERE tableid = table1.id AND user_id = table1.user_id)
This query is taking too much time for considerably bigger table how can I improve the performance of this particular query.