Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

OracleÓÅ»¯Æ÷µÄÓÅ»¯·½Ê½ºÍÓÅ»¯Ä£Ê½

OracleÔÚÖ´ÐÐÒ»¸öSQL֮ǰ,Ê×ÏÈÒª·ÖÎöÒ»ÏÂÓï¾äµÄÖ´Ðмƻ®,È»ºóÔÙ°´Ö´Ðмƻ®È¥Ö´ÐС£·ÖÎöÓï¾äµÄÖ´Ðмƻ®µÄ¹¤×÷ÊÇÓÉÓÅ»¯Æ÷(Optimizer)À´Íê³ÉµÄ¡£²»Í¬µÄÇé¿ö,Ò»ÌõSQL¿ÉÄÜÓжàÖÖÖ´Ðмƻ®,µ«ÔÚijһʱµã,Ò»¶¨Ö»ÓÐÒ»ÖÖÖ´Ðмƻ®ÊÇ×îÓŵÄ,»¨·Ñʱ¼äÊÇ×îÉٵġ£ÏàÐÅÄãÒ»¶¨»áÓÃPl/sql Developer¡¢ToadµÈ¹¤¾ßÈ¥¿´Ò»¸öÓï¾äµÄÖ´Ðмƻ®,²»¹ýÄã¿ÉÄܶÔRule¡¢Choose¡¢First rows¡¢All rowsÕ⼸ÏîÓÐÒÉÎÊ,ÒòΪÎÒµ±³õÒ²ÊÇÕâÑùµÄ,ÄÇʱÎÒÒ²ÒÉ»óΪʲôѡÁËÒÔÉϵIJ»Í¬µÄÏî,Ö´Ðмƻ®¾Í±äÁË?
1¡¢ÓÅ»¯Æ÷µÄÓÅ»¯·½Ê½  
OracleµÄÓÅ»¯Æ÷¹²ÓÐÁ½ÖÖµÄÓÅ»¯·½Ê½,¼´»ùÓÚ¹æÔòµÄÓÅ»¯·½Ê½(Rule-Based Optimization,¼ò³ÆΪRBO)ºÍ»ùÓÚ´ú¼ÛµÄÓÅ»¯·½Ê½(Cost-Based Optimization,¼ò³ÆΪCBO)¡£  
A¡¢RBO·½Ê½£ºÓÅ»¯Æ÷ÔÚ·ÖÎöSQLÓï¾äʱ,Ëù×ñÑ­µÄÊÇOracleÄÚ²¿Ô¤¶¨µÄһЩ¹æÔò¡£±ÈÈçÎÒÃdz£¼ûµÄ,µ±Ò»¸öwhere×Ó¾äÖеÄÒ»ÁÐÓÐË÷Òýʱȥ×ßË÷Òý¡£  
B¡¢CBO·½Ê½£ºÒÀ´ÊÒå¿ÉÖª,ËüÊÇ¿´Óï¾äµÄ´ú¼Û(Cost)ÁË,ÕâÀïµÄ´ú¼ÛÖ÷ÒªÖ¸CpuºÍÄÚ´æ¡£ÓÅ»¯Æ÷ÔÚÅжÏÊÇ·ñÓÃÕâÖÖ·½Ê½Ê±,Ö÷Òª²ÎÕÕµÄÊÇ±í¼°Ë÷ÒýµÄͳ¼ÆÐÅÏ¢¡£Í³¼ÆÐÅÏ¢¸ø³ö±íµÄ´óС ¡¢ÓÐÉÙÐС¢Ã¿Ðеij¤¶ÈµÈÐÅÏ¢¡£ÕâЩͳ¼ÆÐÅÏ¢Æð³õÔÚ¿âÄÚÊÇûÓеÄ,ÊÇÄãÔÚ×öanalyzeºó²Å³öÏÖµÄ,ºÜ¶àµÄʱºî¹ýÆÚͳ¼ÆÐÅÏ¢»áÁîÓÅ»¯Æ÷×ö³öÒ»¸ö´íÎóµÄÖ´Ðмƻ®,ÒòЩÎÒÃÇÓ¦¼°Ê±¸üÐÂÕâЩÐÅÏ¢¡£ÔÚOracle8¼°ÒÔºóµÄ°æ±¾,OracleÁÐÍƼöÓÃCBOµÄ·½Ê½¡£  
ÎÒÃÇÒªÃ÷ÁË,²»Ò»¶¨×ßË÷Òý¾ÍÊÇÓÅµÄ ,±ÈÈçÒ»¸ö±íÖ»ÓÐÁ½ÐÐÊý¾Ý,Ò»´ÎIO¾Í¿ÉÒÔÍê³ÉÈ«±íµÄ¼ìË÷,¶ø´Ëʱ×ßË÷ÒýʱÔòÐèÒªÁ½´ÎIO,Õâʱ¶ÔÕâ¸ö±í×öÈ«±íɨÃè(full table scan)ÊÇ×îºÃµÄ¡£  
2¡¢ÓÅ»¯Æ÷µÄÓÅ»¯Ä£Ê½(Optermizer Mode)  
ÓÅ»¯Ä£Ê½°üÀ¨Rule,Choose,First rows,All rowsÕâËÄÖÖ·½Ê½,Ò²¾ÍÊÇÎÒÃÇÒÔÉÏËùÌá¼°µÄ¡£ÈçÏÂÎÒ½âÊÍһϣº
Rule:²»Óöà˵,¼´×ß»ùÓÚ¹æÔòµÄ·½Ê½¡£
Choolse:ÕâÊÇÎÒÃÇÓ¦¹Û×¢µÄ,ĬÈϵÄÇé¿öÏÂOracleÓõıãÊÇÕâÖÖ·½Ê½¡£Ö¸µÄÊǵ±Ò»¸ö±í»ò»òË÷ÒýÓÐͳ¼ÆÐÅÏ¢,Ôò×ßCBOµÄ·½Ê½,Èç¹û±í»òË÷Òýûͳ¼ÆÐÅÏ¢,±íÓÖ²»ÊÇÌرðµÄС,¶øÇÒÏàÓ¦µÄÁÐÓÐË÷Òýʱ,ÄÇô¾Í×ßË÷Òý,×ßRBOµÄ·½Ê½¡£  
First Rows:ËüÓëChoose·½Ê½ÊÇÀàËƵÄ,Ëù²»Í¬µÄÊǵ±Ò»¸ö±íÓÐͳ¼ÆÐÅϢʱ,Ëü½«ÊÇÒÔ×î¿ìµÄ·½Ê½·µ»Ø²éѯµÄ×îÏȵļ¸ÐÐ,´Ó×ÜÌåÉϼõÉÙÁËÏìӦʱ¼ä¡£  
All Rows:Ò²¾ÍÊÇÎÒÃÇËù˵µÄCostµÄ·½Ê½,µ±Ò»¸ö±íÓÐͳ¼ÆÐÅϢʱ,Ëü½«ÒÔ×î¿ìµÄ·½Ê½·µ»Ø±íµÄËùÓеÄÐÐ,´Ó×ÜÌåÉÏÌá¸ß²éѯµÄÍÌÍÂÁ¿¡£Ã»ÓÐͳ¼ÆÐÅÏ¢Ôò×ß»ùÓÚ¹æÔòµÄ·½Ê½


Ïà¹ØÎĵµ£º

mysqlºÍoracle·ÖÒ³×¢Òâµã

ÕâÀïÊ×ÏÈ˵ÏÂoracle·ÖÒ³²»Ïñmysql·ÖÒ³ÄÇô¼òµ¥Ö±½Ólimit ¾Í¿ÉÒÔÁË.
mysql£ºsql ="select * from talbe limit 0,10";
µÚÒ»¸öÊý±íʾϱ꣬¾ÍÊÇ´ÓµÚ¼¸ÌõÊý¾Ý¿ªÊ¼£¬
µÚ¶þ¸öÊý±íʾÿҳÏÔʾ¶àÉÙÌõÊý¾Ý£¬¿ÉÒÔ˵Êǵ±ÄãÈ·¶¨Ã¿Ò³ÏÔʾ¶àÉÙÐÐʱºò£¬Ëü¾ÍÊÇÒ»¸ö¹Ì¶¨µÄÊý¡£
ÕâÀïÐèҪעÒâµÄÊÇ£¬mysqlµÄ·ÃÎÊϱêÊÇ´Ó0¿ªÊ¼µÄ¡£Õ ......

¹ØÓÚoracleµ¼³öexcelºÍexcelµ¼ÈëoracleµÄ¾­Ñé×ܽá

Ò»¡¢oracleµ¼³öexcel
·½·¨Ò»£º×î¼òµ¥µÄ·½·¨---Óù¤¾ßplsql dev
Ö´ÐÐFile =>new Report Window ¡£ÔÚsql±êÇ©ÖÐдÈëÐèÒªµÄsql£¬µã»÷Ö´Ðлò°´¿ì½Ý¼üF8£¬»áÏȳԳö²éѯ½á¹û¡£ÔÚÓҲ๤¾ßÀ¸£¬¿ÉÒÔÑ¡Ôñ°´Å¥Áí´æΪhtml¡¢copy as html¡¢export results£¬ÆäÖÐexport results°´Å¥ÖоͿÉÒÔµ¼³öexcelÎļþ¡¢csvÎļþ¡¢tsvÎļþ¡¢xmlÎļþ¡ ......

¡¾×ª¡¿ OracleÐÔÄÜÓÅ»¯¼¼ÇÉ

OracleÐÔÄÜÓÅ»¯¼¼ÇÉ
http://tech.it168.com/db/o/2006-06-15/200606151715426.shtml
1.Ñ¡ÓÃÊʺϵÄORACLEÓÅ»¯Æ÷
    ORACLEµÄÓÅ»¯Æ÷¹²ÓÐ3ÖÖ:
    1.RULE(»ùÓÚ¹æÔò) 2.COST(»ùÓڳɱ¾) 3.CHOOSE(Ñ¡ÔñÐÔ)
    ÉèÖÃȱʡµÄÓÅ»¯Æ÷,¿ÉÒÔͨ¹ý¶Ôinit.oraÎļþÖÐOPTIMIZER_MODE²ÎÊ ......

¹ØÓÚORACLE Éó¼ÆµÄһЩÊÓͼºÍ½Å±¾

Éó¼ÆÊÓͼ
STMT_AUDIT_OPTION_MAP    -- Éó¼ÆÑ¡ÏîÀàÐÍ´úÂë
AUDIT_ACTIONS    -- action´úÂë
ALL_DEF_AUDIT_OPTS    -- ¶ÔÏó´´½¨Ê±Ä¬ÈϵĶÔÏóÉó¼ÆÑ¡Ïî
DBA_STMT_AUDIT_OPTS    -- µ±Ç°Êý¾Ý¿âϵͳÉó¼ÆÑ¡Ïî
DBA_PRIV_AUDIT_OPTS    -- ȨÏÞÉó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ