Home  >  Q&A  >  body text

mysql索引 - mysql的普通索引使用问题

mysql一般建表都会设置主键索引 然后对唯一性的字段设置唯一索引
但普通索引从来没用过 普通索引是在非唯一性 需要索引的地方用吗 有没有举例说明 是要对大多数的字段 都进行普通索引吗?

大家讲道理大家讲道理2743 days ago687

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 15:58:58

    Creating an index depends on which fields you want to query. The primary key is indexed by default. For other fields, if you want to query, you also need to create an index. Of course, you don't need to create an index. The purpose of the index is to increase the query speed, but it will increase the size of the database. This is true not only for mysql, but also for other databases.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:58:58

    If there is a field that is frequently queried, and it is not a primary key or an index, add a normal index to increase query efficiency!

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:58:58

    Generally, a normal index is added to the where condition. Various factors are also considered here

    reply
    0
  • Cancelreply