Does limiting a query to one record improve performance

前端 未结 6 1002
清酒与你
清酒与你 2020-12-06 09:30

Will limiting a query to one result record, improve performance in a large(ish) MySQL table if the table only has one matching result?

for example

 s         


        
6条回答
  •  天涯浪人
    2020-12-06 09:58

    I believe the LIMIT is something done after the data set is found and the result set is being built up so I wouldn't expect it to make any difference at all. Making name the primary key will have a significant positive effect though as it will result in an index being made for the column.

提交回复
热议问题