我有一个巨大的桌子(它有超过40百万条记录)和一个列上的索引。该列是一个参考列- typeId。select * from LargeNumberOfItemsTable where typeid=4select * from LargeNumberOfItemsTablewhere typeid=3
不使用索引。当没有使用索引时,查询需要很长时间,但是当我强制提示应该使用
some_other_column不是任何索引的一部分。primary_index_column是主键列;secondary_index_column有一个b树索引,基数为200 (根据MySQL)。以下是explain的结果:
mysql> explain select some_other_column from `table` order by primary_index_column limit----+-------------+---------+-------+---------------+-----