SQLite Forum

Odd, query taking too long
Login
Here is a weird thing,

the following query takes too long

SELECT P.name FROM People P 
WHERE P.nick = P.name AND 
 (SELECT flow FROM Traffic T WHERE T.name = P.name AND T.checkDate="2020-06-25") >= 500

while if I remove the "checkDate" constraint, it gives me 1300 records instantly.

Is the query not being optimized in the first case ?

BTW I have indexes on all the mentioned fields !