OracleÖÐ×éºÏË÷ÒýµÄʹÓÃÏê½â
ÔÚOracleÖпÉÒÔ´´½¨×éºÏË÷Òý£¬¼´Í¬Ê±°üº¬Á½¸ö»òÁ½¸öÒÔÉÏÁеÄË÷Òý¡£ÔÚ×éºÏË÷ÒýµÄʹÓ÷½Ã棬OracleÓÐÒÔÏÂÌص㣺
1¡¢ µ±Ê¹ÓûùÓÚ¹æÔòµÄÓÅ»¯Æ÷£¨RBO£©Ê±£¬Ö»Óе±×éºÏË÷ÒýµÄÇ°µ¼ÁгöÏÖÔÚSQLÓï¾äµÄwhere×Ó¾äÖÐʱ£¬²Å»áʹÓõ½¸ÃË÷Òý£»
2¡¢ ÔÚʹÓÃOracle9i֮ǰµÄ»ùÓڳɱ¾µÄÓÅ»¯Æ÷£¨CBO£©Ê±£¬
Ö»Óе±×éºÏË÷ÒýµÄÇ°µ¼ÁгöÏÖÔÚSQLÓï¾äµÄwhere×Ó¾äÖÐʱ£¬²Å¿ÉÄÜ»áʹÓõ½¸ÃË÷Òý£¬ÕâÈ¡¾öÓÚÓÅ»¯Æ÷¼ÆËãµÄʹÓÃË÷ÒýµÄ³É±¾ºÍʹÓÃÈ«±íɨÃèµÄ³É
±¾£¬Oracle»á×Ô¶¯Ñ¡Ôñ³É±¾µÍµÄ·ÃÎÊ·¾¶£¨Çë¼ûÏÂÃæµÄ²âÊÔ1ºÍ²âÊÔ2£©£»
3¡¢ ´ÓOracle9iÆð£¬OracleÒýÈëÁËÒ»ÖÖеÄË÷ÒýɨÃ跽ʽ——Ë÷ÒýÌøԾɨÃ裨index skip
scan£©£¬ÕâÖÖɨÃ跽ʽֻÓлùÓڳɱ¾µÄÓÅ»¯Æ÷£¨CBO£©²ÅÄÜʹÓá£ÕâÑù£¬µ±SQLÓï¾äµÄwhere×Ó¾äÖм´Ê¹Ã»ÓÐ×éºÏË÷ÒýµÄÇ°µ¼ÁУ¬²¢ÇÒË÷ÒýÌøԾɨÃèµÄ
³É±¾µÍÓÚÆäËûɨÃ跽ʽµÄ³É±¾Ê±£¬Oracle¾Í»áʹÓø÷½Ê½É¨Ãè×éºÏË÷Òý£¨Çë¼ûÏÂÃæµÄ²âÊÔ3£©£»
4¡¢ OracleÓÅ»¯Æ÷ÓÐʱ»á×ö³ö´íÎóµÄÑ¡Ôñ£¬ÒòΪËüÔÙ“´ÏÃ÷”£¬Ò²²»ÈçÎÒÃÇSQLÓï¾ä±àдÈËÔ±¸üÇå³þ±íÖÐÊý¾ÝµÄ·Ö²¼£¬ÔÚÕâÖÖÇé¿öÏ£¬Í¨¹ýʹÓÃÌáʾ£¨hint£©£¬ÎÒÃÇ¿ÉÒÔ°ïÖúOracleÓÅ»¯Æ÷×÷³ö¸üºÃµÄÑ¡Ôñ£¨Çë¼ûÏÂÃæµÄ²âÊÔ4£©¡£
¹ØÓÚÒÔÉÏÇé¿ö£¬ÎÒÃÇ·Ö±ð²âÊÔÈçÏ£º
ÎÒÃÇ´´½¨²âÊÔ±íT£¬¸Ã±íµÄÊý¾ÝÀ´Ô´ÓÚOracleµÄÊý¾Ý×Öµä±íall_objects£¬±íTµÄ½á¹¹ÈçÏ£º
SQL> desc t
Ãû³Æ ÊÇ·ñΪ¿Õ? ÀàÐÍ
----------------------------------------- -------- ---------------------
OWNER NOT NULL VARCHAR2(30)
OBJECT_NAME NOT NULL VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NOT NULL NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(18)
CREATED NOT NULL DATE
LAST_DDL_TIME NOT NULL DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
±íÖеÄÊý¾Ý·Ö²¼Çé¿öÈçÏ£º
SQL> select object_type,count(*) from t group by object_type;
OBJECT_TYPE COUNT(*)
------------------ ----------
CONSUMER GROUP 20
EVALUATION CONTEXT 10
FUNCTION 360
INDEX 69
LIBRARY 20
LOB 20
OPERATOR 20
PACKAGE 1210
PROCEDURE 130
SYNONYM 16100
TABLE 180
TYPE 2750
VIEW 8600
ÒÑÑ¡Ôñ13ÐС£
SQL> select
Ïà¹ØÎĵµ£º
1. round(Num,n) : ËÄÉáÎåÈëÊý×ÖNum£¬±£ÁônλСÊý£¬²»Ð´NĬÈϲ»ÒªÐ¡Êý£¬ËÄÉáÎåÈëµ½ÕûÊý¸öλ
select ROUND(21.237,2) from dual;
½á¹û£º 21.24
2. trunc(Num,n) : ½ØÈ¡Êý×ÖNum£¬±£ÁônλСÊý£¬²»Ð´NĬÈÏÊÇ0£¬¼´²»ÒªÐ¡Êý
select TRUNC(21.237,2) from dual;
½á¹û£º21.2 ......
×÷Õߣº ÈÕÆÚ£º2005-12-8 1:43:32 À´Ô´£ºInternet µã»÷£º´Î ÆÀÂÛ
¡¡¡¡±¾ÎÄÖ»ÌÖÂÛOracleÖÐ×î³£¼ûµÄË÷Òý£¬¼´ÊÇB-treeË÷Òý¡£±¾ÎÄÖÐÉæ¼°µÄÊý¾Ý¿â°æ±¾ÊÇOracle8i¡£
¡¡¡¡Ò». ²é¿´ÏµÍ³±íÖеÄÓû§Ë÷Òý
¡¡¡¡ÔÚOracleÖУ¬SYSTEM±íÊÇ°²×°Êý¾Ý¿âʱ×Ô¶¯½¨Á¢µÄ£¬Ëü°üº¬Êý¾Ý¿âµÄÈ«²¿Êý¾ ......
½ñÌìµÚÒ»´ÎÖªµÀORACLEÔÀ´»¹¿ÉÒÔÕâÑùINSERTµÄ……³¤¼ûʶÁË
Ò»¡¢ÎÞÌõ¼þ INSERT ALL
¶þ¡¢Ìõ¼þ INSERT ALL
Èý¡¢Ìõ¼þ INSERT FIRST
Insert…Select
ʹÓÃInsert SelectʵÏÖͬʱÏò¶à¸ö±í²åÈë¼Ç¼
Ò»¡¢ÎÞÌõ¼þ INSERT ALL
----------------------------------------------------------------------- ......
Ŀ¼
======================================================
1.ʹÓÃrownumΪ¼Ç¼ÅÅÃû
2.ʹÓ÷ÖÎöº¯ÊýÀ´Îª¼Ç¼ÅÅÃû
3.ʹÓ÷ÖÎöº¯ÊýΪ¼Ç¼½øÐзÖ×éÅÅÃû
Ò»¡¢Ê¹ÓÃrownumΪ¼Ç¼ÅÅÃû£º
¡¾1¡¿²âÊÔ»·¾³£º
SQL> desc user_order;
Name   ......