Home  >  Q&A  >  body text

mysql有什么命令可以让mysql同时使用两个索引

我知道USE INDEX,IGNORE INDEX,FORCE INDEX这3个命令,分别是
添加 USE INDEX 来提供你希望 MySQ 去参考的索引列
表,就可以让 MySQL 不再考虑其他可用的索引。
IGNORE INDEX让 MySQL 忽略一个或者多个索引。
FORCE INDEX为强制 MySQL 使用一个特定的索引。
哪有什么命令可以让mysql同时使用两个索引来进行查询吗?

大家讲道理大家讲道理2742 days ago1023

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:23:18

    What does it mean? Do you want a joint index? Something like this:

    alter table test add INDEX `sindex` (`aaa`,`bbb`,`ccc`)

    aaa, bbb, ccc are the three columns of the test table

    reply
    0
  • 迷茫

    迷茫2017-04-17 15:23:18

    Mysql will merge the indexes. For relevant information in the manual, please see http://dev.mysql.com/doc/refman/5.6/en/index-merge-optimization.html

    for details.

    reply
    0
  • 阿神

    阿神2017-04-17 15:23:18

    The answer above is to create a composite primary key. If you query, select group by a,b

    reply
    0
  • Cancelreply