There’s a table:
`id` INT(10) NOT NULL AUTO_INCREMENT,
`status` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE,
When I processing the flowing statement (There’s more than 1000 records in this table), a table scan is processed. Why primary key index does not work?
SELECT * FROM t_test WHERE id = FLOOR(1 + RAND() * 1000)
And sometimes there 2 different results, why would this happen?
index invalid when mysql select by random id and sometimes return tow different values