posts - 25, comments - 69, trackbacks - 0, articles - 2
          select * from a,b where a.id=b.id(+);
          select * from a left join b on a.id=b.id;

          很多資料說(shuō)上面兩個(gè)語(yǔ)句的效果是一樣的,實(shí)際上今天經(jīng)過(guò)測(cè)試發(fā)現(xiàn)兩者的執(zhí)行計(jì)劃大不相同(查詢結(jié)果是一樣的);
          至于為什么會(huì)這樣,暫時(shí)沒(méi)有深究,手頭的一個(gè)例子表明按照第一種寫(xiě)法的效率會(huì)高,或許其他的例子結(jié)果不一樣,等有時(shí)間的時(shí)候再測(cè)試一下吧.

          Feedback

          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?  回復(fù)  更多評(píng)論   

          2007-12-14 10:11 by hao ren
          是的,我也發(fā)現(xiàn)了這個(gè)問(wèn)題。
          因?yàn)樗俣鹊脑?,差點(diǎn)搞死我!
          不得已又換成了+號(hào),
          速度居然有兩倍的差距!!
          要是你有什么好的資料或結(jié)果的話,
          請(qǐng)告訴我一聲,謝謝。
          wang20yin@126.com

          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?  回復(fù)  更多評(píng)論   

          2008-09-16 11:59 by Noodle
          學(xué)習(xí),呵呵

          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?[未登錄](méi)  回復(fù)  更多評(píng)論   

          2008-10-06 14:44 by null
          把不同的執(zhí)行計(jì)劃貼出來(lái)看看啊。

          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?[未登錄](méi)  回復(fù)  更多評(píng)論   

          2009-01-19 12:17 by aa
          select * from a,b where a.id=b.id(+) and a.flg = '0';
          select * from a left join b on a.id=b.id and a.flg = '0';

          條件追加:
          -〉and a.flg = '0'

          你看一下區(qū)別吧!

          處理方法:
          select * from a left join b on a.id=b.id and a.flg = '0';
          同下!
          select * from a ,b where a.id=b.id and (a.flg = '0' or a.flg is null);


          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?  回復(fù)  更多評(píng)論   

          2010-04-01 18:02 by feiyvefanli
          這個(gè)是版本問(wèn)題 好像9i以后 才增加的left join 以前都是使用(+)
          后續(xù)版本向下兼容 所以9i之后 這兩者是通用的 但建議使用left jion增加可讀性

          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?[未登錄](méi)  回復(fù)  更多評(píng)論   

          2011-05-12 09:58 by AA
          @aa

          select * from a,b where a.id=b.id(+) and a.flg = '0';
          select * from a left join b on a.id=b.id and a.flg = '0';
          這兩個(gè)不對(duì)等,
          把第一個(gè)修改一下
          select * from a,b where a.id=b.id(+) and a.flg(+) = '0';
          這樣 就和
          select * from a left join b on a.id=b.id and a.flg = '0';
          對(duì)等了

          # re: oracle 的left join和(+)真的可以起到一樣的效果嗎?[未登錄](méi)  回復(fù)  更多評(píng)論   

          2011-07-19 09:53 by feng
          oracle 在解析的時(shí)候會(huì)把left join right join 都轉(zhuǎn)換成+
          如果你寫(xiě)sql的時(shí)候都是用+就少了轉(zhuǎn)換
          主站蜘蛛池模板: 平安县| 邮箱| 承德市| 马关县| 古交市| 保山市| 金堂县| 板桥市| 水城县| 康定县| 平湖市| 保定市| 清远市| 东阳市| 温宿县| 金昌市| 泉州市| 福贡县| 阳原县| 天全县| 叶城县| 福安市| 江安县| 西贡区| 繁峙县| 蓬溪县| 湄潭县| 天峻县| 凉城县| 饶阳县| 兴和县| 海兴县| 甘德县| 海晏县| 潼关县| 左贡县| 衡阳县| 潍坊市| 平陆县| 隆林| 云浮市|