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

OracleÖеÄHash JoinÏé½â

OracleÖеÄHash JoinÏé½â
Ò»¡¢  hash join¸ÅÄî
     Hashjoin(HJ)ÊÇÒ»ÖÖÓÃÓÚequi-join£¨¶øanti-join¾ÍÊÇʹÓÃNOT INʱµÄjoin£©µÄ¼¼Êõ¡£
ÔÚOracleÖУ¬ËüÊÇ´Ó7.3¿ªÊ¼ÒýÈëµÄ£¬ÒÔ´úÌæsort-mergeºÍnested-loop join·½Ê½£¬
Ìá¸ßЧÂÊ¡£ÔÚCBO£¨hash joinÖ»ÓÐÔÚCBO²Å¿ÉÄܱ»Ê¹Óõ½£©Ä£Ê½Ï£¬ÓÅ»¯Æ÷¼ÆËã´ú¼Ûʱ£¬
Ê×ÏȻῼ ÂÇhash join¡£¿ÉÒÔͨ¹ýÌáʾuse_hashÀ´Ç¿ÖÆʹÓÃhash join£¬
Ò²¿ÉÒÔͨ¹ýÐ޸ĻỰ»òÊý¾Ý¿â²ÎÊýHASH_JOIN_ENABLED=FALSE£¨Ä¬ÈÏΪTRUE£©Ç¿ÖƲ»Ê¹ÓÃhash join¡£
     Hash joinµÄÖ÷Òª×ÊÔ´ÏûºÄÔÚÓÚCPU£¨ÔÚÄÚ´æÖд´½¨ÁÙʱµÄhash±í£¬²¢½øÐÐhash¼ÆË㣩£¬¶ømerge joinµÄ×ÊÔ´ÏûºÄÖ÷ÒªÔÚÓÚ´ËÅÌIO£¨É¨Ãè±í»òË÷Òý£©¡£ÔÚ²¢ÐÐϵͳÖУ¬
hash join¶ÔCPUµÄÏûºÄ¸ü¼ÓÃ÷ÏÔ¡£ËùÒÔÔÚCPU½ôÕÅʱ£¬×îºÃÏÞÖÆʹÓÃhash join¡£
     ÔÚ¾ø´ó¶àÊýÇé¿öÏ£¬hash joinЧÂʱÈÆäËûjoin·½Ê½Ð§Âʸü¸ß£º
     ÔÚSort-Merge Join(SMJ)£¬Á½ÕűíµÄÊý¾Ý¶¼ÐèÒªÏÈ×öÅÅÐò£¬È»ºó×ömerge¡£Òò´ËЧÂÊÏà¶Ô×î²î£»
     Nested-Loop Join(NL)ЧÂʱÈSMJ¸ü¸ß¡£ÌرðÊǵ±Çý¶¯±íµÄÊý¾ÝÁ¿ºÜ´ó£¨¼¯µÄÊƸߣ©Ê±¡£ÕâÑù¿ÉÒÔ²¢ÐÐɨÃèÄÚ±í¡£
     Hash joinЧÂÊ×î¸ß£¬ÒòΪֻҪ¶ÔÁ½ÕűíɨÃèÒ»´Î¡£Hash joinÒ»°ãÓÃÓÚÒ»ÕÅС±íºÍÒ»ÕÅ´ó±í½øÐÐjoinʱ¡£Hash joinµÄ¹ý³Ì´óÖÂÈçÏ£¨ÏÂÃæËù˵µÄÄÚ´æ¾ÍÖ¸sort area£¬¹ØÓÚ¹ý³Ì£¬ºóÃæ»á×÷ÏêϸÌÖÂÛ£©£º
1£®  Ò»ÕÅС±í±»hashÔÚÄÚ´æÖС£ÒòΪÊý¾ÝÁ¿Ð¡£¬ËùÒÔÕâÕÅС±íµÄ´ó¶àÊýÊý¾ÝÒѾ­×¤ÈëÔÚÄÚ´æÖУ¬Ê£ÏµÄÉÙÁ¿Êý¾Ý±»·ÅÖÃÔÚÁÙʱ±í¿Õ¼äÖУ»
2£®  ÿ¶ÁÈ¡´ó±íµÄÒ»Ìõ¼Ç¼£¬¾ÍºÍС±íÖÐÄÚ´æÖеÄÊý¾Ý½øÐбȽϣ¬Èç¹û·ûºÏ£¬ÔòÁ¢¼´Êä³öÊý¾Ý£¨Ò²¾ÍÊÇ˵ûÓжÁÈ¡ÁÙʱ±í¿Õ¼äÖеÄС±íµÄÊý
¾Ý£©¡£¶øÈç¹û´ó±íµÄÊý¾ÝÓëС±íÖÐÁÙʱ±í¿Õ¼äµÄÊý¾ÝÏà·ûºÏ£¬Ôò²»Ö±½ÓÊä³ö£¬¶øÊÇÒ²±»´æ´¢ÁÙʱ±í¿Õ¼äÖС£
3£®  µ±´ó±íµÄËùÓÐÊý¾Ý¶¼¶ÁÈ¡Íê±Ï£¬½«ÁÙʱ±í¿Õ¼äÖеÄÊý¾ÝÒÔÆäÊä³ö¡£
     Èç¹ûС±íµÄÊý¾ÝÁ¿×㹻С£¨Ð¡ÓÚhash area size£©£¬ÄÇËùÓÐÊý¾Ý¾Í¶¼ÔÚÄÚ´æÖÐÁË£¬¿ÉÒÔ±ÜÃâ¶ÔÁÙʱ±í¿Õ¼äµÄ¶Áд¡£
     Èç¹ûÊDz¢Ðл·¾³Ï£¬Ç°ÃæÖеĵÚ2²½¾Í±ä³ÉÈçÏÂÁË£º
2£®  ÿ¶ÁÈ¡Ò»Ìõ´ó±íµÄ¼Ç¼£¬ºÍÄÚ´æÖÐС±íµÄÊý¾Ý±È½Ï£¬Èç¹û·ûºÏÏÈ×öjoin£¬¶ø²»Ö±½ÓÊä³ö£¬Ö±µ½ÕûÕÅ´ó±íÊý¾Ý¶ÁÈ¡Íê±Ï¡£Èç¹ûÄÚ´æ×ã¹»£¬
JoinºÃµÄÊý¾Ý¾Í±£´æÔÚ


Ïà¹ØÎĵµ£º

OracleºÍMySQL¡¢PostgreSQLÌØÐÔ¶Ô±È

¡¡Ëæ×ÅÏÖ´úÊý¾Ý¿â¿ÉÓÃÌØÕ÷¼¯µÄѸËÙÔö¼Ó£¬ºÜÄÑÇø·ÖÊëºÃÊ뻵¡£ÀýÈçOracleÀï¾ÍÓÐÐí¶àÄã¿ÉÄÜ´ÓÀ´¶¼²»ÐèÒªµÄ¸ß¼¶Êý¾Ý²Ö¿âÌØÕ÷¡£´ËÍâÒ²¿ÉÄÜÓÐһЩÆäËü²»¿É»òȱµÄÌØÕ÷±ÈÈçACIDÊÂÎñÌØÐÔ¡£ÎÒÃÇÀ´¿´Ò»¿´Ö÷ÒªµÄһЩÌØÕ÷£¬±ÈÈç´æ´¢¹ý³Ì£¬ÊÓͼ£¬¿ìÕÕ£¬±íÊý¾ÝÀàÐͺÍÊÂÎñµÈµÈ¡£Í¬Ê±ÎÒÃÇ·ÖÎöÒ»ÏÂPostgresql£¬MySQLºÍOracleÕ⼸¸öÊý¾Ý¿â£¬È»º ......

ÈçºÎ¿ª·¢ORACLE´æ´¢¹ý³Ì

ÔÚÎÒµÄÉÏÒ»¸öÒøÐÐÏîÄ¿ÖУ¬ÎÒ½Óµ½±àдORACLE´æ´¢¹ý³ÌµÄÈÎÎñ£¬ÎÒÊdzÌÐòÔ±£¬ÄÔ´üÀïÖ»ÓÐһЩÈçºÎʹÓÃCALLABLE½Ó¿Úµ÷Óô洢¹ý³ÌµÄ¾­Ñ飬һʱ²»ÖªÈçºÎÏÂÊÖ£¬ÎÒ²éÔÄÁËһЩ×ÊÁÏ£¬Í¨¹ýʵ¼ù·¢ÏÖ±àдORACLE´æ´¢¹ý³ÌÊǷdz£²»ÈÝÒ׵Ť×÷£¬¼´Ê¹ÉÏ·ÒԺ󣬵÷ÊÔºÍÑéÖ¤·Ç³£Âé·³¡£¼òµ¥µØ½²£¬Oracle´æ´¢¹ý³Ì¾ÍÊÇ´æ´¢ÔÚOracleÊý¾Ý¿âÖеÄÒ»¸ö³ÌÐò ......

²é¿´OracleÖ´Ðмƻ®µÄ¼¸ÖÖ·½·¨

²é¿´OracleÖ´Ðмƻ®µÄ¼¸ÖÖ·½·¨
Ò»¡¢Í¨¹ýPL/SQL Dev¹¤¾ß
    1¡¢Ö±½ÓFile->New->Explain Plan Window£¬ÔÚ´°¿ÚÖÐÖ´ÐÐsql¿ÉÒԲ鿴¼Æ»®½á¹û¡£ÆäÖУ¬Cost±íʾcpuµÄÏûºÄ£¬µ¥Î»Îªn%£¬Cardinality±íʾִÐеÄÐÐÊý£¬µÈ¼ÛRows¡£
    2¡¢ÏÈÖ´ÐÐ EXPLAIN PLAN FOR   select * from tab ......

Ïê½âLinuxÏÂOracleµÄ¾²Ä¬°²×°


ÔÚijЩÌØÊâµÄÇé¿öÏ£¬ÈçÒòΪÍøÂç»òÕßXÅäÖõĹØϵÎÞ·¨Á¬½Óµ½X server»òÕßÖ÷»úÉÏûÓÐX£¬¾Í¿ÉÒÔʹÓþ²Ä¬°²×°µÄ·½Ê½°²×°Êý¾Ý¿â£¬Í¬ÑùÈç¹ûÐèÒª´ó¹æÄ£²¿Êð£¬Ôò¾²Ä¬°²×°½«»á´ó´ó¼õÇáDBAµÄÖظ´ÀͶ¯Á¦£¬¶øÇÒ¾²Ä¬°²×°²»ÐèÒªX£¬´Ó°²×°Ð§ÂÊ  
ÔÚijЩÌØÊâµÄÇé¿öÏ£¬ÈçÒòΪÍøÂç»òÕßXÅäÖõĹØϵÎÞ·¨Á¬½Óµ½X server»òÕßÖ÷»úÉÏûÓÐX£ ......

ORACLE SQLÓï¾äÓÅ»¯


1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄǾÍÐèҪѡÔñ½»²æ±í(intersection ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ