where中不用的字段; 字段不在where语句出现时不要添加索引,如果where后含IS NULL /IS NOT NULL/ like ‘%输入符%’等条件,不建议使用索引。
索引使用<>时,效果一般; 不建议使用索引。
反思&扩展
建表时为啥都有个自增 ID?
业务无关性:创建主键的时候尽量使用 MySQL 自增主键而不是使用业务生成的值当做主键。官方给出的建议:" When choosing primary key values, consider using arbitrary values (a synthetic key) rather than relying on values derived from some other source (a natural key). "