search

Home  >  Q&A  >  body text

索引 - Mysql Limit查询优化问题

1.《高性能MYSQL》上的,没看懂这是什么优化,film_id应该是主键吧,求解释

2.顺便再问一个问题,这个sql说明使用索引,不过file_name并不是索引列,具体执行的时候是怎么执行,扫描索引列再匹配file_name,看着是这样子吧,这个sql能改写下达到相同的想过吗

ringa_leeringa_lee2821 days ago753

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 11:38:28

    1. This rewriting is mainly based on the structural characteristics of the index. The original statement may cause cross-page when the field is long, and the limit statement itself is very inefficient. In the rewritten query, index coverage can be achieved by querying film_id alone.

    2. I don’t understand what you mean.

    reply
    0
  • Cancelreply