What is faster in MySQL? WHERE sub request = 0 or IN list
Posted
by
Nicolas Manzini
on Stack Overflow
See other posts from Stack Overflow
or by Nicolas Manzini
Published on 2012-06-04T10:36:24Z
Indexed on
2012/06/04
10:41 UTC
Read the original article
Hit count: 262
Hello I was wondering what is better in MySQL.
I have a SELECT querry that exclude every entry associated to a banned userID
currently I have a subquerry clause in the WHERE statement that goes like
AND (SELECT COUNT(*) FROM TheBlackListTable WHERE userID = userList.ID AND blackListedID = :userID2 ) = 0
Which will accept every userID not present in the TheBlackListTable
Would it be faster to retrieve first all Banned ID in a previous request and replace the previous clause by
AND creatorID NOT IN listOfBannedID
Thank you!
© Stack Overflow or respective owner