• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 百萬級數據下幾種SQL性能測試(2)

    發表于:2012-11-29來源:博客園作者:East神奇點擊數: 標簽:性能測試
    結論: 1)從以上測試結果可以看出,不論是否索引排序字段,也不管是何種索引,row_number都能得到最高的性能,其次Max/Top的方式測試性能也不錯。 2)在使

      結論:

      1)從以上測試結果可以看出,不論是否索引排序字段,也不管是何種索引,row_number都能得到最高的性能,其次Max/Top的方式測試性能也不錯。

      2)在使用非聚焦索引的情況下,性能并無任何提示,甚至要慢于無索引的情況,可能是因為SQL先要去查找索引表,然后根據索引結果再去查找實體表,在這過程浪費了資源。

      3)聚焦索引也的正確應用才能發揮其該有的優勢啊!

      綜合結果:row_number> max/top > top

      二、in、or、union關鍵字性能測試

      介于網上有很多關于in/or/union等關鍵字的性能討論,本人也小試了一把,測試結果如下。

      1、in

      select * from video where id in(100,101,102,103,104,105,106,107,108,109)

      2、union

      select * from video where id =100

      union all select * from video where id =101

      union all select * from video where id =102

      union all select * from video where id =103

      union all select * from video where id =104

      union all select * from video where id =105

      union all select * from video where id =106

      union all select * from video where id =107

      union all select * from video where id =108

      union all select * from video where id =109

      3、or

      select * from video where id=100 or id=101 or id=102 or id=103or id=104 or id=105 or id=106 or id=107 or id=108 or id=109

    in PK or PK union

     

    ID列索引

    in

    union

    or

    無索引

    cpu

    reads

    duration

    0

    37

    54

    cpu

    reads

    duration

    0

    58

    104

    cpu

    reads

    duration

    0

    41

    56

    聚焦索引

    cpu

    reads

    duration

    0

    44

    54

    cpu

    reads

    duration

    0

    54

    58

    cpu

    reads

    duration

    0

    40

    54

    非聚焦索引

    cpu

    reads

    duration

    0

    43

    53

    cpu

    reads

    duration

    16

    61

    62

    cpu

    reads

    duration

    0

    43

    54

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>