<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    waterye

    行列互換

    舊系統中的一條sql在某些情況下無法工作(反應超慢), 此sql是使用關聯進行行列互換, 從執行計劃和重建索引都查不出原因所在, 10G已經對sql不挑剔了, 暈啊(周五晚上的時間就這樣浪費掉)
     1select table2.id, 
     2       NVL(t1.count0as count1, 
     3       NVL(t2.count0as count2, 
     4       NVL(t3.count0as count3, 
     5       NVL(t4.count0as count4
     6 from table1 t1, table1 t2, table1 t3, table1 t4, table2 
     7 where t1.shop_id = ? and t1.type = 'a'
     8   and t2.shop_id = ? and t2.type = 'b'
     9   and t3.shop_id = ? and t3.type = 'c'
    10   and t4.shop_id = ? and t4.type = 'd'
    11   and table2.id = t1.id
    12   and table2.id = t2.id
    13   and table2.id = t3.id
    14   and table2.id = t4.id
    15 order by table2.code
    shop_id = 1386時很快(0.3s), shop_id = 1404時超慢(15s以上), 時間是在pl/sql developer執行時計算的, 不知是否oracle的bug

    只能對sql進行優化, 但一時不知如何解決(本人較笨), 只有發揮copy paste的能力(找google), http://www.oracle.com.cn/viewthread.php?tid=65638
    select t1.id, 
           
    sum(decode(t1.type, 'a'count0)) count1, 
           
    sum(decode(t1.type, 'b'count0)) count2,
           
    sum(decode(t1.type, 'c'count0)) count3,
           
    sum(decode(t1.type, 'd'count0)) count4
      
    from table1 t1, table2 t2
     
    where t1.id = t2.id
       
    and t1.shop_id = ?
     
    group by t1.id
     
    order by max(t2.code)

    執行時間0.17s(有點興奮, 程序員只有這點好處)

    還有通過SP進行行列互換的, 可到itpub上找找

    posted on 2005-12-17 01:32 waterye 閱讀(868) 評論(0)  編輯  收藏 所屬分類: oracle

    主站蜘蛛池模板: 黄网站色视频免费在线观看的a站最新| 亚洲AV日韩综合一区尤物| 亚洲精品综合久久| 亚洲欧洲精品成人久久奇米网| 亚洲精品无码成人片久久不卡| 免费无遮挡无遮羞在线看| 国产日韩AV免费无码一区二区三区| 久久青草免费91线频观看站街| 成人免费午夜无码视频| 免费人成网站7777视频| 亚洲av无码专区在线播放| 亚洲精品国产肉丝袜久久| 男女污污污超污视频免费在线看| 国产成人免费手机在线观看视频| 亚洲AV综合色一区二区三区| 日本在线看片免费| 亚洲小说图片视频| 免费一级不卡毛片| 亚洲无成人网77777| 97在线线免费观看视频在线观看 | 国产在线观看麻豆91精品免费| 国产精品四虎在线观看免费 | 2020天堂在线亚洲精品专区| 国产免费福利体检区久久| 精品久久香蕉国产线看观看亚洲| 亚洲狠狠婷婷综合久久久久| 久久精品乱子伦免费| 亚洲国产美女精品久久| 国产精品嫩草影院免费| 91在线免费观看| 亚洲黄片毛片在线观看| a毛片全部播放免费视频完整18| 亚洲综合在线观看视频| 国产一区二区免费视频| 亚洲一级毛片免费在线观看| 99re在线免费视频| 久久亚洲综合色一区二区三区 | 成人au免费视频影院| 久久亚洲精品无码AV红樱桃| 成人一a毛片免费视频| a级毛片在线免费|