?? oracle sql性能優(yōu)化系列 (十一)3--acnow_net.htm
字號:
<DIV id=article>
<TABLE cellSpacing=0 cellPadding=0 width=540 border=0 style="TABLE-LAYOUT: fixed">
<TBODY>
<TR>
<TH class=f24><FONT color=#05006c>
<H1>ORACLE SQL性能優(yōu)化系列 (十一)</H1>
</FONT></TH>
</TR>
<TR>
<TD> <HR SIZE=1 bgcolor="#d9d9d9"> </TD>
</TR>
<TR>
<TD align=middle height=20>http://Tech.acnow.net 2005-4-29 <FONT color=#a20010>網(wǎng)絡(luò)</FONT></TD>
</TR>
<TR>
<TD height=15></TD>
</TR>
<TR>
<TD class=l17><FONT class=f14 id=zoom><BR><BR> 0 sorts (disk)<BR><BR> 1003 rows processed<BR><BR>用UNION的效果可以從consistent gets和 SQL*NET的數(shù)據(jù)交換量的減少看出<BR><BR> <BR><BR>37. 用IN來替換OR<BR><BR> <BR><BR>下面的查詢可以被更有效率的語句替換:<BR><BR> <BR><BR>低效:<BR><BR> <BR><BR>SELECT….<BR><BR>FROM LOCATION<BR><BR>WHERE LOC_ID = 10<BR><BR>OR LOC_ID = 20<BR><BR>OR LOC_ID = 30<BR><BR> <BR><BR>高效<BR><BR>SELECT…<BR><BR>FROM LOCATION<BR><BR>WHERE LOC_IN IN (10,20,30);<BR><BR> <BR><BR>譯者按:<BR><BR>這是一條簡單易記的規(guī)則,但是實(shí)際的執(zhí)行效果還須檢驗(yàn),在ORACLE8i下,兩者的執(zhí)行路徑似乎是相同的. <BR><BR> <BR><BR> <BR><BR>38. 避免在索引列上使用IS NULL和IS NOT NULL<BR><BR>避免在索引中使用任何可以為空的列,ORACLE將無法使用該索引 .對于單列索引,如果列包含空值,索引中將不存在此記錄. 對于復(fù)合索引,如果每個列都為空,索引中同樣不存在此記錄. 如果至少有一個列不為空,則記錄存在于索引中.<BR><BR>舉例:<BR><BR> 如果唯一性索引建立在表的A列和B列上, 并且表中存在一條記錄的A,B值為(123,null) , ORACLE將不接受下一條具有相同A,B值(123,null)的記錄(插入). 然而如果<BR><BR>所有的索引列都為空,ORACLE將認(rèn)為整個鍵值為空而空不等于空. 因此你可以插入1000<BR><BR>條具有相同鍵值的記錄,當(dāng)然它們都是空!<BR><BR> <BR><BR> 因?yàn)榭罩挡淮嬖谟谒饕兄?所以WHERE子句中對索引列進(jìn)行空值比較將使ORACLE停用該索引.<BR><BR>舉例:<BR><BR> <BR><BR>低效: (索引失效)<BR><BR>SELECT …<BR><BR>FROM DEPARTMENT<BR><BR>WHERE DEPT_CODE IS NOT NULL;<BR><BR> <BR><BR>高效: (索引有效)<BR><BR>SELECT …<BR><BR>FROM DEPARTMENT<BR><BR>WHERE DEPT_CODE >=0;<BR><BR> <BR><p><div align="right">本新聞共<font color=red>3</font>頁,當(dāng)前在第<font color=red>3</font>頁 <a href="164559059816455975203.shtml">1</a> <a href="164559059816455975203_2.shtml">2</a> <font color="red">3</font> </div></p>
<P clear=all></P>
</FONT></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<BR>
上一篇:<a href='../../2005-4/29/164559059816455954036.shtml' title ='ORACLE常用傻瓜問題1000問(之五)'>ORACLE常用傻瓜問題1000問(之五)</a> 下一篇:<a href='../../2005-4/29/164559059816455980543.shtml' title ='ORACLE SQL性能優(yōu)化系列 (十二)'>ORACLE SQL性能優(yōu)化系列 (十二)</a>
<BR>
<BR>
<TABLE class="tf" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD style="PADDING-RIGHT: 20px" align=right>
【<script type="text/javascript">
<!--
document.write("<a href=\"http:\/\/tech.acnow.net\/Sendmail.asp?NewsID=059816455975203\" target=\"_blank\">發(fā)送給好友</a>");
-->
</script>】
【<A href="http://bbs.acnow.net/Index.asp?boardid=103">論壇</A>】
【<script type="text/javascript">
<!--
document.write("<a target=\"_blank\" Href=\"http:\/\/tech.acnow.net\/Users\/AddFavorite.asp?NewsID=8994\" style=\"CURSOR:hand\" onClick=\"window.external.AddFavorite(document.location.href,document.title)\" onMouseMove=\"status='收藏本頁';\" onMouseOut=\"status='';\">添加到收藏夾</a>");
-->
</script>】
【<A target="_self" href="javascript:doZoom(16)">大</A>
<A target="_self" href="javascript:doZoom(14)">中</A>
<A target="_self" href="javascript:doZoom(12)">小</A>】
【<A target="_self" href="javascript:doPrint()">打印</A>】
【<A target="_self" href="javascript:window.close()">關(guān)閉</A>】</TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=545 border=0>
<TBODY>
<TR>
<TD height=19></TD>
</TR>
<TR>
<TD bgColor=#c6c9d1 height=1></TD>
</TR>
<TR>
<TD height=10></TD>
</TR>
</TBODY>
</TABLE>
<BR>
<DIV id=links>
<TABLE cellSpacing=0 cellPadding=0 width=542 border=0>
<TBODY>
<TR>
<TD><table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/16455905981645592205.shtml title="ORACLE SQL性能優(yōu)化系列 (十三)">ORACLE SQL性能優(yōu)化系列 (十三)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/164558059816455832996.shtml title="ORACLE SQL性能優(yōu)化系列 (四)">ORACLE SQL性能優(yōu)化系列 (四)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/164558059816455832253.shtml title="ORACLE SQL性能優(yōu)化系列 (八)">ORACLE SQL性能優(yōu)化系列 (八)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/164559059816455944859.shtml title="ORACLE SQL性能優(yōu)化系列 (十)">ORACLE SQL性能優(yōu)化系列 (十)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/164558059816455862139.shtml title="ORACLE SQL性能優(yōu)化系列 (二)">ORACLE SQL性能優(yōu)化系列 (二)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/164558059816455831878.shtml title="ORACLE SQL性能優(yōu)化系列 (五)">ORACLE SQL性能優(yōu)化系列 (五)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/html/SoftWare/SoftwareEducate/OracleAuthentication/2006-5/29/150826355.shtml title="ORACLE SQL性能優(yōu)化系列 (一)">ORACLE SQL性能優(yōu)化系列 (一)</a></td></tr>
<tr>
<td Height=1 colspan="1">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td Height=1 background="http://tech.acnow.net/Files/Img/title_line.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="http://tech.acnow.net/Files/Img/list_nav_spacer.gif"><a Class="a2" href= http://tech.acnow.net/Html/DataBase/Oracle/2005-4/29/164558059816455894796.shtml title="ORACLE SQL性能優(yōu)化系列 (三)">ORACLE SQL性能優(yōu)化系列 (三)</a></td></tr>
<tr>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -