In response to this SQL question, I came across the assertion that a statement with a fixed value IN() much slower than an INNER JOIN with the same content, to the extent that it is better to create a temporary table for the values ββand join them. This is true (in general, with MySQL, any other SQL engine), and if so, why? Intuitively, IN should be faster - you compare a potential match with a fixed set of values ββthat are already in memory and in the required format, while with JOIN you will need to consult indexes, potentially load data from disk, and perform other operations that may be unnecessary with IN. Did I miss something important?
Note that unlike this question , and this is a lot of duplicates, I'm talking about IN() with a fixed set of values, not a subquery.
sql mysql
Stasm
source share