📄 oracle sql性能优化系列 (十二)1--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性能优化系列 (十二)</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>网络</FONT></TD>
</TR>
<TR>
<TD height=15></TD>
</TR>
<TR>
<TD class=l17><FONT class=f14 id=zoom><BR><BR>块内存的优化也是相当重要的. 下面的SQL可以用来查询排序的消耗量<BR><BR> <BR><BR>Select substr(name,1,25) "Sort Area Name",<BR><BR> substr(value,1,15) "Value"<BR><BR>from v$sysstat<BR><BR>where name like 'sort%'<BR><BR> <BR><BR>42. 使用提示(Hints)<BR><BR>对于表的访问,可以使用两种Hints.<BR><BR>FULL 和 ROWID<BR><BR> <BR><BR>FULL hint 告诉ORACLE使用全表扫描的方式访问指定表.<BR><BR>例如:<BR><BR> SELECT /*+ FULL(EMP) */ *<BR><BR> FROM EMP<BR><BR> WHERE EMPNO = 7893;<BR><BR> <BR><BR> ROWID hint 告诉ORACLE使用TABLE ACCESS BY ROWID的操作访问表.<BR><BR> <BR><BR> 通常, 你需要采用TABLE ACCESS BY ROWID的方式特别是当访问大表的时候, 使用这种方式, 你需要知道ROIWD的值或者使用索引.<BR><BR> 如果一个大表没有被设定为缓存(CACHED)表而你希望它的数据在查询结束是仍然停留<BR><BR>在SGA中,你就可以使用CACHE hint 来告诉优化器把数据保留在SGA中. 通常CACHE hint 和 FULL hint 一起使用.<BR><BR>例如:<BR><BR>SELECT /*+ FULL(WORKER) CACHE(WORKER)*/ *<BR><BR>FROM WORK;<BR><BR> <BR><BR> 索引hint 告诉ORACLE使用基于索引的扫描方式. 你不必说明具体的索引名称<BR><BR>例如:<BR><BR> SELECT /*+ INDEX(LODGING) */ LODGING<BR><BR> FROM LODGING<BR><BR> WHERE MANAGER = ‘BILL GATES’;<BR><BR> <BR><BR> 在不使用hint的情况下, 以上的查询应该也会使用索引,然而,如果该索引的重复值过多而你的优化器是CBO, 优化器就可能忽略索引. 在这种情况下, 你可以用INDEX hint强制ORACLE使用该索引.<BR><BR> <BR><BR> ORACLE hints 还包括ALL_ROWS, FIRST_ROWS, RULE,USE_NL, USE_MERGE, USE_HASH 等等.<BR><BR> <BR><BR>译者按:<BR><BR> 使用hint , 表示我们对ORACLE优化器缺省的执行路径不满意,需要手工修改.<BR><BR>这是一个很有技巧性的工作. 我建议只针对特定的,少数的SQL进行hint的优化.<BR><BR>对ORACLE的优化器还是要有信心(特别是CBO)<BR><BR> <BR><p><div align="right">本新闻共<font color=red>2</font>页,当前在第<font color=red>2</font>页 <a href="164559059816455980543.shtml">1</a> <font color="red">2</font> </div></p>
<P clear=all></P>
</FONT></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<BR>
上一篇:<a href='../../2005-4/29/164559059816455975203.shtml' title ='ORACLE SQL性能优化系列 (十一)'>ORACLE SQL性能优化系列 (十一)</a> 下一篇:<a href='../../2005-4/29/16455905981645592205.shtml' title ='ORACLE SQL性能优化系列 (十三)'>ORACLE SQL性能优化系列 (十三)</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=059816455980543\" target=\"_blank\">发送给好友</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=8995\" 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()">关闭</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/164559059816455975203.shtml title="ORACLE SQL性能优化系列 (十一)">ORACLE SQL性能优化系列 (十一)</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性能优化系列 (四)">ORACLE SQL性能优化系列 (四)</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/164558059816455833067.shtml title="ORACLE SQL性能优化系列 (七)">ORACLE SQL性能优化系列 (七)</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性能优化系列 (八)">ORACLE SQL性能优化系列 (八)</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性能优化系列 (三)">ORACLE SQL性能优化系列 (三)</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/164558059816455850688.shtml title="ORACLE SQL性能优化系列 (六)">ORACLE SQL性能优化系列 (六)</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性能优化系列 (十)">ORACLE SQL性能优化系列 (十)</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性能优化系列 (一)">ORACLE SQL性能优化系列 (一)</a></td></tr>
<tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -