Does limiting a query to one record improve performance

前端 未结 6 1000
清酒与你
清酒与你 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

    Yes, you will notice a performance difference when dealing with the data. One record takes up less space than multiple records. Unless you are dealing with many rows, this would not be much of a difference, but once you run the query, the data has to be displayed back to you, which is costly, or dealt with programmatically. Either way, one record is easier than multiple.

提交回复
热议问题