有100条同样的数据top 1 和 distinct 哪个查询速度快

解决方案 »

  1.   

    TOP1后面order by不?有索引没?有的话TOP1快
    distinct效率是不会高的
      

  2.   

    没有order by 就是select top 1 * from table 
    select distinct * from table
      

  3.   

    distinct效率是不会高的 ,因为要扫描每个数据,去作比对TOP1 快
      

  4.   

    top 1 快
    distinct要扫描所有,基本没有性能提升,数据量越大差距越明显,100条数据这样的,全查出来一条一条数一遍用的时间也比启动一个查询的消耗低,无所谓