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

ORACLEÎﻯÊÓͼ ¸ßËÙ¸ßЧ ´´½¨ÎﻯÊÓͼÌá¸ß²éѯËÙ¶È


ÄãÊÇ·ñΪµÈ´ýÄãµÄ²éѯ·µ»Ø½á¹û¶ø¸Ðµ½Æ£±¹£¿ÄãÊÇ·ñÒѾ­ÎªÔöÇ¿Ë÷ÒýºÍµ÷ÓÅSQL¶ø¸Ðµ½Æ£±¹£¬µ«ÈÔÈ»²»ÄÜÌá¸ß²éѯÐÔÄÜ£¿ÄÇô£¬ÄãÊÇ·ñÒѾ­¿¼ÂÇ´´½¨ÎﻯÊÓͼ£¿ÓÐÁËÎﻯÊÓͼ£¬ÄÇЩ¹ýÈ¥ÐèÒªÊýСʱÔËÐеı¨¸æ¿ÉÒÔÔÚ¼¸·ÖÖÓÄÚÍê³É¡£ÎﻯÊÓͼ¿ÉÒÔ°üÀ¨Áª½Ó£¨join£©ºÍ¼¯ºÏ£¨aggregate£©
ÄãÊÇ·ñΪµÈ´ýÄãµÄ²éѯ·µ»Ø½á¹û¶ø¸Ðµ½Æ£±¹£¿ÄãÊÇ·ñÒѾ­ÎªÔöÇ¿Ë÷ÒýºÍµ÷ÓÅSQL¶ø¸Ðµ½Æ£±¹£¬µ«ÈÔÈ»²»ÄÜÌá¸ß²éѯÐÔÄÜ£¿ÄÇô£¬ÄãÊÇ·ñÒѾ­¿¼ÂÇ´´½¨ÎﻯÊÓͼ£¿ÓÐÁËÎﻯÊÓͼ£¬ÄÇЩ¹ýÈ¥ÐèÒªÊýСʱÔËÐеı¨¸æ¿ÉÒÔÔÚ¼¸·ÖÖÓÄÚÍê³É¡£ÎﻯÊÓͼ¿ÉÒÔ°üÀ¨Áª½Ó£¨join£©ºÍ¼¯ºÏ£¨aggregate£©£¬ËüÌṩÁËÒ»ÖÖ´¢´æÔ¤¼ÆËã½á¹ûµÄ·½·¨¡£
ÔÚÖ´ÐÐÒ»¸ö²éѯʱ£¬ÓÅ»¯Æ÷»áÅж¨·ÃÎÊÎﻯÊÓͼ»òÊý¾ÝפÁôµÄ»ù´¡±íÊÇ·ñ¸ü¿ìһЩ¡£Èç¹ûÓÅ»¯Æ÷Åж¨²éѯÎﻯÊÓͼÊǸüºÃµÄ½â¾ö·½°¸£¬ÄÇôÓÅ»¯Æ÷»áÔÚÒ»¸ö±»³ÆΪ“²éѯ¸Äд”£¨query rewrite£©µÄ¹ý³ÌÖиÄдSQL²éѯ¡£ÔÚÕâ¸ö¹ý³ÌÖУ¬²»ÐèÒª¶ÔÈκÎSQL»òÓ¦ÓóÌÐò´úÂë½øÐÐÐ޸ģ¬ËùÒÔÈκÎÀûÓÃSQL·ÃÎÊÊý¾Ý¿âµÄÓ¦ÓóÌÐò»òÌض¨²éѯ¹¤¾ß¶¼¿ÉµÃÒæÓÚʹÓÃÎﻯÊÓͼ¡£µ±Îª¼ÆËã½á¹û¶øÐèÒª·ÃÎʵÄÊý¾ÝÊýÁ¿Ô¶´óÓÚ½á¹û£¨È缯ºÏ£©µÄ´óСʱ£¬×îÊʺÏʹÓòéѯ¸Äд£¬µ«ÊÇËüÒ²¿É±»ÓÃÓÚ¼ÓËÙ°º¹óµÄÁª½Ó»ò¹æ»®¡£
±¾ÎÄÊ×ÏȽéÉÜÁËÓÅ»¯Æ÷¿ÉÒÔÖ´ÐеIJéѯ¸ÄдÀàÐÍ¡£È»ºó£¬ËüÌÖÂÛÁË°ïÖúÈ·¶¨´´½¨×î¼ÑÎﻯÊÓͼ¼¯µÄ¹¤¾ß£¬Ê¹ÓÅ»¯Æ÷Äܹ»¸Äд¶à¸ö²éѯ¡£ÀûÓÃÕâЩ¹¤¾ß´´½¨µÄÎﻯÊÓͼÔÚÆä»ù´¡Êý¾Ý·¢Éú±ä»¯Ê±»¹¿ÉÒÔ¿ìËÙˢС£Èç¹ûÄã²»ÖªµÀ´´½¨Ò»¸öÎﻯÊÓͼ¡¢Ò»¸öË÷Òý»òͬʱ´´½¨Á½ÕßÄÄÖÖ¸üºÃ£¬ÄÇôÔÚOracleÊý¾Ý¿â10gÖÐÒýÈëµÄSQL Access Advisor¿ÉÒÔͨ¹ý·ÖÎö¸ø¶¨µÄ¹¤×÷¸ººÉ°ïÖúÄã×ö³ö¾ö¶¨¡£
²éѯ¸ÄдÀàÐÍ
¿ÉÄÜÓÐÐí¶àÀàÐ͵IJéѯ¸Äд£»µ±ÎﻯÊÓͼµÄ¶¨Òå²éѯÓë²éѯµÄÎı¾ÍêÈ«Æ¥Åäʱ£¬¾Í·¢Éú×î¼òµ¥ºÍ×îÏÔÖøÀàÐ͵IJéѯ¸Äд¡£µ«ÊÇ£¬µ±ÏàͬÎﻯÊÓͼ¿ÉÓÃÓÚÏàÓ¦¶à¸ö²éѯʱ£¬¾Í¿ÉÒÔʵÏÖ²éѯ¸ÄдµÄ×î´óºÃ´¦¡£ÏÖÔÚ£¬ÎÒÃǽ«¾ÙÀý˵Ã÷һЩOracleÓÅ»¯Æ÷ʹÓõĹæÔò£¬ÒÔÈ·¶¨ËüÊÇ·ñ½«Ê¹ÓÃÎﻯÊÓͼÀ´ÏìÓ¦¡£
¶ÔÓÚ±¾ÎÄÖеÄʾÀý£¬¿ÉÒÔ¿¼Âǽ«Ò»¸öÐÇÐÎģʽÖеÄPURCHASES±í¿´×÷ÊÂʵ±í£¨fact table£©£¬Æ䷶ΧÓÉtime_key»®·Ö¡£Î¬¶È±í£¨dimension table£©--TIME¡¢PRODUCTºÍCUSTOMERS--°üº¬Ö÷¼ü time_key¡¢product_idºÍcust_id¡£ÔÚPURCHASES±íÖÐÓÐÒýÓø÷¸öά¶È±íµÄÍâ¼üÔ¼Êø¡£
¿¼ÂÇÒ»ÏÂÇåµ¥ 1ÖÐËù´´½¨µÄÎﻯÊÓͼ£¬¸ÃÊÓͼ°´Ô°´product_id¼ÆËãÏúÊÛ×ܶîºÍÏúÊÛ×Ü´ÎÊý¡£×¢Ò⣺¶ÔÓÚÓÃÓÚ²éѯ¸ÄдµÄÎﻯÊÓͼ£¬±ØÐëÓÐENABLE QUERY REWRITE×Ӿ䡣»¹ÓУ¬³õʼ»¯


Ïà¹ØÎĵµ£º

ORACLEÎﻯÊÓͼ Query RewriteµÄÒ»°ãÀí½âÖ®Ò»

http://www.anysql.net/oracle/query_rewrite_01.html
  Query Rewrite ÔÚÊý¾Ý²Ö¿âÊÇÊÇÒ»¸ö·Ç³£ÓÐÓõļ¼Êõ, TomÔÚ<<Effective Oracle by Design>>Ò»ÊéÖн«ÊµÌ廯ÊÓͼ(MView)³ÆΪÊÇÊý¾Ý²Ö¿âµÄË÷Òý, ÕâÊÇÔÙÌùÇв»¹ýµÄÁË, ÔÚOLTPÖе±SELECTÓï¾äµÄËùÓеÄ×ֶζ¼ÔÚË÷ÒýÖÐʱ, Oracle¿ÉÒÔ²»´Ó±í¶ÁÊý¾Ý, ¶øÖ± ......

ORACLEÎﻯÊÓͼ Query RewriteµÄÒ»°ãÀí½âÖ®ËÄ


   ¿ÉÒÔ¿´µ½MVIEWÔÚQuery RewriteÖеÄÖØÒªÐÔ, ÒªÔÚʵ¼ÊÓ¦ÓÃÖÐʹÓÃ, ¾ÍµÃÖªµÀËüµÄºÜ¶à·½Ãæ, ÆäÖÐË¢ÐÂÊÇ×îÖ÷ÒªµÄ:
1, MVIEWÈÕÖ¾µÄ½¨Á¢
2, »ã×ÜÐ͵ÄMIVEWµÄË¢ÐÂ
3, JOINÀàÐ͵ÄMVIEWµÄË¢ÐÂ
4, ¸ü¸´ÔÓµÄMVIEWµÄË¢ÐÂ
5, ·ÖÇøʱµÄMVIEWµÄË¢ÐÂ
   ÔÚÕâ¶ùÎÒÃÇÖ÷ÒªÌÖÂÛµÄÊÇÈçºÎʵÏÖFastË¢ÐÂ, ·ñÔòûÓжàÉ ......

OracleÊý¾Ý¿â±í¿Õ¼ä²Ù×÷

// ½¨Á¢±í¿Õ¼ä£¨Ö¸¶¨Îļþ·¾¶£©¡£
create TABLESPACE EAS_D_sptcc0_STANDARD DATAFILE 'F:\oracledb\EAS_D_sptcc0_STANDARD.dbf' size 10000M EXTENT MANAGEMENT local;
// ɾ³ý±í¿Õ¼ä£¨Ö¸¶¨Îļþ·¾¶£©¡£
DROP TABLESPACE temp_data INCLUDING CONTENTS AND DATAFILES;
// ½¨Á¢ÁÙʱ±í¿Õ¼ä¡£
CREATE TEMPORARY TABLESPA ......

Oracle µÄÊý¾Ýµ¼Èëµ¼³ö¼° Sql Loader (sqlldr) µÄÓ÷¨

Ô­ÎÄ:http://www.blogjava.net/Unmi/archive/2009/01/05/249956.html
ÔÚ Oracle Êý¾Ý¿âÖУ¬ÎÒÃÇͨ³£ÔÚ²»Í¬Êý¾Ý¿âµÄ±í¼ä¼Ç¼½øÐи´ÖÆ»òǨÒÆʱ»áÓÃÒÔϼ¸ÖÖ·½·¨£º
1. A ±íµÄ¼Ç¼µ¼³öΪһÌõÌõ·ÖºÅ¸ô¿ªµÄ insert Óï¾ä£¬È»ºóÖ´ÐвåÈëµ½ B ±íÖÐ
2. ½¨Á¢Êý¾Ý¿â¼äµÄ dblink£¬È»ºóÓà create table B as select * from A ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ