There seems to be an optimizer problem in 5.1, if you put a NULL in the IN clause of a SELECT. For example, given the following table: CREATE TABLE foo ( a INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (a) ); Compare these two EXPLAINs: mysql> EXPLAIN * FROM foo WHERE a IN (160000, 160001, 160002)\G… Continue reading Don’t put a NULL in the IN clause in 5.1