亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch15.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<P>The best arrangement of elements within your query, particularly in the <TT>WHERE</TT>clause, really depends on the order of the processing steps in a specific implementation.The arrangement of conditions depends on the columns that are indexed, as well ason which condition will retrieve the fewest records.</P><P>You do not have to use a column that is indexed in the <TT>WHERE</TT> clause,but it is obviously more beneficial to do so. Try to narrow down the results of theSQL statement by using an index that returns the fewest number of rows. The conditionthat returns the fewest records in a table is said to be the <I>most restrictivecondition</I>. As a general statement, you should place the most restrictive conditionslast in the <TT>WHERE</TT> clause. (Oracle's query optimizer reads a <TT>WHERE</TT>clause from the bottom up, so in a sense, you would be placing the most restrictivecondition first.)</P><P>When the optimizer reads the most restrictive condition first, it is able to narrowdown the first set of results before proceeding to the next condition. The next condition,instead of looking at the whole table, should look at the subset that was selectedby the most selective condition. Ultimately, data is retrieved faster. The most selectivecondition may be unclear in complex queries with multiple conditions, subqueries,calculations, and several combinations of the <TT>AND</TT>, <TT>OR</TT>, and <TT>LIKE</TT>.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>TIP:</B></FONT><B> </B>Always check your database documentation	to see how SQL statements are processed in your implementation. <HR></BLOCKQUOTE><P>The following test is one of many we have run to measure the difference of elapsedtime between two uniquely arranged queries with the same content. These examplesuse Oracle7.3 relational database management system. Remember, the optimizer in thisimplementation reads the <TT>WHERE</TT> clause from the bottom up.</P><P>Before creating the <TT>SELECT</TT> statement, we selected distinct row countson each condition that we planned to use. Here are the values selected for each condition:</P><P><TABLE BORDER="1">	<TR>		<TD VALIGN="TOP"><I>Condition</I></TD>		<TD VALIGN="TOP"><I>Distinct Values</I></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>calc_ytd = '-2109490.8'</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">13,000 +</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>dt_stmp = '01-SEP-96'</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">15</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>output_cd = '001'</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">13</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>activity_cd = 'IN'</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">10</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>status_cd = 'A'</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">4</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>function_cd = '060'</TT></TD>		<TD VALIGN="TOP">6</TD>	</TR></TABLE><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The most restrictive condition is	also the condition with the most distinct values. <HR></BLOCKQUOTE><P>The next example places the most restrictive conditions first in the <TT>WHERE</TT>clause:<H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SET TIMING ON</B>  2  <B>SELECT COUNT(*)</B>  3  <B>FROM FACT_TABLE</B>  4  <B>WHERE CALC_YTD = '-2109490.8'</B>  5   <B> AND DT_STMP = '01-SEP-96'</B>  6    <B>AND OUTPUT_CD = '001'</B>  7    <B>AND ACTIVITY_CD = 'IN'</B>  8   <B> AND STATUS_CD = 'A'</B>  9   <B> AND FUNCTION_CD = '060';</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">COUNT(*)--------       81 row selected.Elapsed:  00:00:15.37</FONT></PRE><P>This example places the most restrictive conditions last in the <TT>WHERE</TT>clause:<H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SET TIMING ON</B>  2 <B> SELECT COUNT(*)</B>  3  <B>FROM FACT_TABLE</B>  4 <B> WHERE FUNCTION_CD = '060'</B>  5   <B> AND STATUS_CD = 'A'</B>  6   <B> AND ACTIVITY_CD = 'IN'</B>  7   <B> AND OUTPUT_CD = '001'</B>  8    <B>AND DT_STMP = '01-SEP-96'</B>  9   <B> AND CALC_YTD = '-2109490.8';</B>COUNT(*)--------       81 row selected.Elapsed:  00:00:01.80</FONT></PRE><H5>ANALYSIS:</H5><P>Notice the difference in elapsed time. Simply changing the order of conditionsaccording to the given table statistics, the second query ran almost 14 seconds fasterthan the first one. Imagine the difference on a poorly structured query that runsfor three hours!<H3><FONT COLOR="#000077"><B>Procedures</B></FONT></H3><P>For queries that are executed on a regular basis, try to use procedures. A <I>procedure</I>is a potentially large group of SQL statements. (Refer to Day 13, &quot;AdvancedSQL Topics.&quot;)</P><P>Procedures are compiled by the database engine and then executed. Unlike an SQLstatement, the database engine need not optimize the procedure before it is executed.Procedures, as opposed to numerous individual queries, may be easier for the userto maintain and more efficient for the database.<H3><FONT COLOR="#000077"><B>Avoiding </B>OR</FONT></H3><P>Avoid using the logical operator <TT>OR</TT> in a query if possible. <TT>OR</TT>inevitably slows down nearly any query against a table of substantial size. We findthat <TT>IN</TT> is generally much quicker than <TT>OR</TT>. This advice certainlydoesn't agree with documentation stating that optimizers convert <TT>IN</TT> argumentsto <TT>OR</TT> conditions. Nevertheless, here is an example of a query using multiple<TT>OR</TT>s:<H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT *</B>  2  <B>FROM FACT_TABLE</B>  3 <B> WHERE STATUS_CD = 'A'</B>  4    <B> OR STATUS_CD = 'B'</B>  5   <B>  OR STATUS_CD = 'C'</B>  6   <B>  OR STATUS_CD = 'D'</B>  7   <B>  OR STATUS_CD = 'E'</B>  8  <B>   OR STATUS_CD = 'F'</B>  9  <B>ORDER BY STATUS_CD;</B></FONT></PRE><P>Here is the same query using <TT>SUBSTR</TT> and <TT>IN</TT>:<H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT *</B>  2  <B>FROM FACT_TABLE</B>  3  <B>WHERE STATUS_CD IN ('A','B','C','D','E','F')</B>  4 <B> ORDER BY STATUS_CD;</B></FONT></PRE><H5>ANALYSIS:</H5><P>Try testing something similar for yourself. Although books are excellent sourcesfor standards and direction, you will find it is often useful to come to your ownconclusions on certain things, such as performance.</P><P>Here is another example using <TT>SUBSTR</TT> and <TT>IN.</TT> Notice that thefirst query combines <TT>LIKE</TT> with <TT>OR</TT>.</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT *</B>  2  <B>FROM FACT_TABLE</B>  3  <B>WHERE PROD_CD LIKE 'AB%'</B>  4    <B> OR PROD_CD LIKE 'AC%'</B>  5    <B> OR PROD_CD LIKE 'BB%'</B>  6    <B> OR PROD_CD LIKE 'BC%'</B>  7    <B> OR PROD_CD LIKE 'CC%'</B>  8  <B>ORDER BY PROD_CD;</B></FONT></PRE><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT *</B>  2  <B>FROM FACT_TABLE</B>  3  <B>WHERE SUBSTR(PROD_CD,1,2) IN ('AB','AC','BB','BC','CC')</B>  4  <B>ORDER BY PROD_CD;</B></FONT></PRE><H5>ANALYSIS:</H5><P>The second example not only avoids the <TT>OR</TT> but also eliminates the combinationof the <TT>OR</TT> and <TT>LIKE</TT> operators. You may want to try this exampleto see what the real-time performance difference is for your data.<H2><FONT COLOR="#000077"><B>OLAP Versus OLTP</B></FONT></H2><P>When tuning a database, you must first determine what the database is being usedfor. An online analytical processing (OLAP) database is a system whose function isto provide query capabilities to the end user for statistical and general informationalpurposes. The data retrieved in this type of environment is often used for statisticalreports that aid in the corporate decision-making process. These types of systemsare also referred to as decision support systems (DSS). An online transactional processing(OLTP) database is a system whose main function is to provide an environment forend-user input and may also involve queries against day-to-day information. OLTPsystems are used to manipulate information within the database on a daily basis.Data warehouses and DSSs get their data from online transactional databases and sometimesfrom other OLAP systems.<H3><FONT COLOR="#000077"><B>OLTP Tuning</B></FONT></H3><P>A transactional database is a delicate system that is heavily accessed in theform of transactions and queries against day-to-day information. However, an OLTPdoes not usually require a vast sort area, at least not to the extent to which itis required in an OLAP environment. Most OLTP transactions are quick and do not involvemuch sorting.</P><P>One of the biggest issues in a transactional database is rollback segments. Theamount and size of rollback segments heavily depend on how many users are concurrentlyaccessing the database, as well as the amount of work in each transaction. The bestapproach is to have several rollback segments in a transactional environment.</P><P>Another concern in a transactional environment is the integrity of the <I>transactionlogs, </I>which are written to after each transaction. These logs exist for the solepurpose of recovery. Therefore, each SQL implementation needs a way to back up thelogs for use in a &quot;point in time recovery.&quot; SQL Server uses dump devices;Oracle uses a database mode known as ARCHIVELOG mode. Transaction logs also involvea performance consideration because backing up logs requires additional overhead.<H3><FONT COLOR="#000077"><B>OLAP Tuning</B></FONT></H3><P>Tuning OLAP systems, such as a data warehouse or decision support system, is muchdifferent from tuning a transaction database. Normally, more space is needed forsorting.</P><P>Because the purpose of this type of system is to retrieve useful decision-makingdata, you can expect many complex queries, which normally involve grouping and sortingof data. Compared to a transactional database, OLAP systems typically take more space

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区久久久久| 国产v综合v亚洲欧| 久久久久久久综合日本| 色天天综合色天天久久| 国产曰批免费观看久久久| 樱桃视频在线观看一区| 久久免费看少妇高潮| 欧美性做爰猛烈叫床潮| 成人的网站免费观看| 久久精品国产亚洲高清剧情介绍| 亚洲精品久久7777| 国产精品久久国产精麻豆99网站| 日韩天堂在线观看| 在线观看免费成人| 99视频精品全部免费在线| 国产麻豆精品95视频| 美女视频黄 久久| 夜色激情一区二区| 亚洲欧美成aⅴ人在线观看| 精品sm在线观看| 欧美精品aⅴ在线视频| 色噜噜狠狠一区二区三区果冻| 国产成人福利片| 国产麻豆精品theporn| 久久精品国产77777蜜臀| 亚洲宅男天堂在线观看无病毒| 中文字幕一区二| 国产精品入口麻豆原神| 久久九九久精品国产免费直播| 精品国产自在久精品国产| 91精品国产91久久综合桃花| 国产精品网站一区| 久久综合网色—综合色88| 欧美一区二区三区日韩| 欧美精品777| 91麻豆精品久久久久蜜臀| 91精品免费观看| 3751色影院一区二区三区| 欧美福利视频一区| 5858s免费视频成人| 欧美高清视频不卡网| 欧美日本一区二区三区四区 | www.在线欧美| 国产精品66部| 国产ts人妖一区二区| 99久久精品一区二区| 91麻豆国产福利精品| 欧美性欧美巨大黑白大战| 91激情五月电影| 欧美精品在线一区二区三区| 欧美福利一区二区| 精品国产免费一区二区三区四区 | 久久精品国产99久久6| 粉嫩av一区二区三区| 国内精品不卡在线| 国产精品免费人成网站| 国产精品久久免费看| 亚洲色图视频网| 亚洲自拍另类综合| 蜜桃一区二区三区四区| 国产成人欧美日韩在线电影| 99国产精品久久久久久久久久| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 精品一区二区在线免费观看| 激情五月播播久久久精品| 成人精品免费看| 欧美日韩在线观看一区二区| 精品免费视频一区二区| 全部av―极品视觉盛宴亚洲| 国产精品一区二区在线观看网站| 国产91精品露脸国语对白| 在线亚洲欧美专区二区| 91精品国产综合久久香蕉麻豆| 亚洲精品一区二区三区香蕉| 国产精品全国免费观看高清| 亚洲成年人网站在线观看| 国产乱人伦偷精品视频不卡| 99re热这里只有精品视频| 日韩一区二区在线观看视频播放| 国产日韩欧美激情| 亚洲无人区一区| 国产suv精品一区二区6| 欧美日韩一区二区欧美激情 | 亚洲一区二区三区中文字幕| 久久国产婷婷国产香蕉| 91亚洲国产成人精品一区二区三| 欧美一区二区三区小说| 国产精品国产三级国产aⅴ中文| 三级不卡在线观看| 不卡一区二区在线| 精品久久人人做人人爽| 亚洲一区二区三区四区在线免费观看| 久久精品72免费观看| 欧美亚洲尤物久久| 国产精品污www在线观看| 男女视频一区二区| 欧洲亚洲精品在线| 欧美韩国日本一区| 韩国v欧美v日本v亚洲v| 欧美日韩国产系列| 国产精品你懂的| 精品亚洲国内自在自线福利| 欧美亚洲国产一区二区三区| 欧美国产精品劲爆| 国产一区二区三区精品欧美日韩一区二区三区| 在线观看免费视频综合| 国产精品视频第一区| 极品销魂美女一区二区三区| 欧美专区亚洲专区| 亚洲欧洲成人av每日更新| 国产盗摄女厕一区二区三区| 日韩免费观看高清完整版 | 日韩欧美国产系列| 亚洲线精品一区二区三区八戒| 99久久综合精品| 国产免费观看久久| 国产真实乱对白精彩久久| 91精品国产一区二区人妖| 一区二区三区加勒比av| 99久久精品免费| 欧美激情综合五月色丁香| 国产乱理伦片在线观看夜一区| 日韩午夜精品视频| 麻豆精品视频在线观看视频| 7777精品伊人久久久大香线蕉最新版| 一区二区三区精品在线| 91老司机福利 在线| 自拍偷拍亚洲欧美日韩| 99久久99久久久精品齐齐| 国产精品天天看| 国产不卡视频在线播放| 国产欧美精品一区二区三区四区 | 久久久国产一区二区三区四区小说| 美女在线观看视频一区二区| 6080午夜不卡| 麻豆极品一区二区三区| 精品久久久久一区二区国产| 激情文学综合插| 国产性色一区二区| 成人国产在线观看| 亚洲美女屁股眼交| 一本到一区二区三区| 一区二区三区日韩在线观看| 欧美午夜精品电影| 亚洲v精品v日韩v欧美v专区| 欧美一卡在线观看| 久久99国产精品麻豆| 26uuu亚洲综合色欧美| 国产精品自拍网站| 国产精品久久99| 欧洲av在线精品| 亚洲国产一区二区视频| 欧美一区在线视频| 韩国三级在线一区| 国产精品网站一区| 日本韩国精品一区二区在线观看| 一卡二卡欧美日韩| 欧美一区二区三区在| 国产成人免费av在线| 亚洲情趣在线观看| 3d成人动漫网站| 国产成人av电影| 亚洲精品va在线观看| 欧美日韩精品欧美日韩精品一| 精品一区二区三区视频| 国产精品女主播av| 欧美日韩mp4| 国产乱妇无码大片在线观看| 亚洲女人****多毛耸耸8| 欧美日韩国产一级| 国产精品99久久久久久似苏梦涵| 亚洲婷婷综合久久一本伊一区 | 欧美怡红院视频| 久久99久久99小草精品免视看| 欧美激情综合在线| 在线成人av网站| 成人黄色一级视频| 天天操天天综合网| 国产精品久久一卡二卡| 欧美日韩国产高清一区二区| 国产91精品露脸国语对白| 午夜久久久影院| 国产欧美精品在线观看| 欧美人与禽zozo性伦| 久久久久久久久岛国免费| 欧美日韩你懂得| 成人午夜激情在线| 美国一区二区三区在线播放| 亚洲色图19p| 久久网站最新地址| 欧美日韩免费不卡视频一区二区三区 | 久久影视一区二区| 欧美亚洲自拍偷拍| 成人国产视频在线观看| 久久99久久精品| 日韩高清中文字幕一区| 最近日韩中文字幕| 久久久久久久久一| 欧美一区二区在线观看| 97久久人人超碰|