SQLÓïÑÔÒÕÊõ(PDF¸ñʽ)-µÚ12²¿·Ö
°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
from¡¡orderdetail¡¡
join¡¡articles¡¡
on¡¡£¨articles¡£artid=orderdetail¡£artid£©¡¡
where¡¡articles¡£artname¡¡='BATMOBILE'£©¡¡
»ò²ÉÓÃfrom×Ó¾äÖеÄ×Ó²éѯ£º¡¡
select¡¡distinct¡¡orders¡£custid¡¡
from¡¡orders£»¡¡
£¨select¡¡orderdetails¡£ordid¡¡
from¡¡orderdetail¡¡
join¡¡articles¡¡
on¡¡£¨articles¡£artid=orderdetail¡£artid£©¡¡
where¡¡articles¡£artname¡¡='BATMOBILE'£©¡¡assub_q¡¡
where¡¡sub_q¡£ordid¡¡=orders¡£ordid¡¡
ÎÒÈÏΪµÚÒ»¸ö²éѯ½ÏΪÒ׶Á£¬µ±È»ÕâÈ¡¾öÓÚ¸öÈËϲºÃ¡£±ðÍüÁË£¬ÔÚ×Ó²éѯ½á¹ûÉϵġ¡in£¨£©¡¡Ìõ¼þ°µ¡¡
º¬ÁËdistinct´¦Àí£¬»áÒýÆðÅÅÐò£¬¶øÅÅÐò°ÑÎÒÃÇ´øµ½Á˹ØϵģÐ͵ıßÔµ¡£¡¡
×ܽ᣺Èç¹ûҪʹÓÃ×Ó²éѯ£¬ÔÚÑ¡Ôñ¹ØÁª×Ó²éѯ¡¢»¹ÊǷǹØÁª×Ó²éѯµÄÎÊÌâÉÏ£¬Ó¦×Ðϸ¿¼ÂÇ¡£¡¡
¶à¸ö¿í·ºÌõ¼þµÄ½»¼¯¡¡
Small¡¡Intersection¡¡of¡¡BroadCriteria¡¡
±¾½ÚÌÖÂÛ¶Ô¶à¸ö¿í·ºÌõ¼þÈ¡½»¼¯»ñµÃ½ÏС½á¹û¼¯µÄÇé¿ö¡£ÔÚ·Ö±ðʹÓø÷¸öÌõ¼þʱ£¬»á²úÉú´óÐÍ¡¡
Êý¾Ý¼¯£¬µ«×îÖÕ¸÷¸ö´óÐÍÊý¾Ý¼¯µÄ½»¼¯È´ÊÇС½á¹û¼¯¡£¡¡
¼ÌÐøÉÏÒ»½ÚµÄÀý×Ó¡£Èç¹û¡°Åж϶©¹ºµÄÉÌÆ·ÊÇ·ñ´æÔÚ¡±¿ÉÑ¡ÔñÐԽϲ¾Í±ØÐ뿼ÂÇÆäËûÌõ¼þ£¨·ñ¡¡
Ôò½á¹û¼¯¾Í²»ÊÇС½á¹û¼¯£©¡£ÔÚÕâÖÖÇé¿öÏ£¬Ê¹ÓÃÕý¹æÁ¬½Ó¡¢¹ØÁª×Ó²éѯ£¬»¹ÊǷǹØÁª×Ó²éѯ£¬¡¡
Òª¸ù¾Ý²»Í¬Ìõ¼þµÄ¹ýÂËÄÜÁ¦ºÍÒÑ´æÔÚÄÄЩË÷Òý¶ø¶¨¡£¡¡
ÀýÈ磬ÓÉÓÚ²»Ì«³©Ïú£¬ÎÒÃDz»ÔÙ¼ìË÷¶©¹ºòùòð³µµÄÈË£¬¶øÊDzéÕÒÉÏÖÜÁù¹ºÂòijÖÖ·ÊÔíµÄ¿Í»§¡£¡¡
´Ëʱ£¬ÎÒÃǵIJéѯÓï¾äΪ£º¡¡
select¡¡distinct¡¡orders¡£custid¡¡
from¡¡orders¡¡
join¡¡orderdetail¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡58¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
on¡¡£¨orderdetail¡£ordid¡¡=orders¡£ordid£©¡¡
join¡¡articles¡¡
on¡¡£¨articles¡£artid=orderdetail¡£artid£©¡¡
where¡¡articles¡£artname¡¡='SOAP'¡¡
and¡¡
Õâ¸ö´¦ÀíÁ÷³ÌºÜºÏÂß¼£¬¸ÃÂß¼ºÍÉÌÆ·¾ßÓи߿ÉÑ¡ÔñÐÔʱÏà·´£ºÏÈÈ¡µÃÉÌÆ·£¬ÔÙÈ¡µÃ°üº¬ÉÌÆ·¡¡
µÄÃ÷ϸ¶©µ¥£¬×îºó´¦Àí¶©µ¥¡£¶ÔÄ¿Ç°ÌÖÂ۵ķÊÔí¶©µ¥µÄÇé¿ö¶øÑÔ£¬ÎÒÃÇÓ¦¸ÃÏÈÈ¡µÃÔڽ϶ÌÆڼ䡡
ÄÚϵÄÉÙÁ¿¶©µ¥£¬ÔÙ¼ì²éÄÄЩ¶©µ¥Éæ¼°·ÊÔí¡£´Óʵ¼ù½Ç¶ÈÀ´¿´£¬ÎÒÃǽ«Ê¹ÓÃÍêÈ«²»Í¬µÄË÷Òý£º¡¡
µÚÒ»¸öÀý×ÓÐèÒªorderdetail±íµÄÉÌÆ·Ãû³Æ¡¢ÉÌÆ·IDÕâÁ½¸ö×Ö¶ÎÉϵÄË÷Òý£¬ÒÔ¼°orders±íµÄÖ÷¼ü¡¡
orderidÉϵÄË÷Òý£»¶ø´Ë·ÊÔí¶©µ¥µÄÀý×ÓÐèÒªorders±íÈÕÆÚ×ֶεÄË÷Òý¡¢orderdetail±íµÄ¶©µ¥ID×Ö¡¡
¶ÎµÄË÷Òý£¬ÒÔ¼°articles±íµÄÖ÷¼üorderidÉϵÄË÷Òý¡£µ±È»£¬ÎÒÃÇÊ×ÏȼÙÉèË÷Òý¶ÔÉÏÊöÁ½Àý¶¼ÊÇ×î¡¡
¼Ñ·½Ê½¡£¡¡
ÒªÖªµÀÄÄЩ¿Í»§ÔÚÉÏÐÇÆÚÁùÂòÁË·ÊÔí£¬×îÃ÷ÏÔ¶ø×ÔÈ»µÄÑ¡ÔñÊÇʹÓùØÁª×Ó²éѯ£º¡¡
select¡¡distinct¡¡orders¡£custid¡¡
from¡¡orders¡¡
where¡¡
andexists¡¡£¨select¡¡1¡¡
from¡¡orderdetail¡¡
join¡¡articles¡¡
on¡¡£¨articles¡£artid=orderdetail¡£artid£©¡¡
where¡¡articles¡£artname¡¡='SOAP'¡¡
andorderdetails¡£ordid¡¡=orders¡£ordid£©¡¡
ÔÚÕâ¸ö·½·¨ÖУ¬ÎªÁËʹ¹ØÁª×Ó²éѯËٶȽϿ죬ÐèÒªorderdetail±íµÄ¡¡ordid×Ö¶ÎÉÏÓÐË÷Òý£¨¾Í¿ÉÒÔ¡¡
ͨ¹ýÖ÷¼üartidÈ¡µÃÉÌÆ·£¬ÎÞÐèÆäËûË÷Òý£©¡£¡¡
µÚ3ÕÂÒÑÌáµ½£¬ÊÂÎñ´¦ÀíÐÍÊý¾Ý¿â£¨transactional¡¡database£©µÄË÷ÒýÊÇÖÖÉݳޣ¬ÒòΪËü´¦ÔÚ¾³£¸ü¡¡
¸ÄµÄ»·¾³ÖУ¬Î¬»¤µÄ³É±¾ºÜ¸ß¡£ÓÚÊÇÑ¡Ôñ¡°´Î¼Ñ¡±½â¾ö·½°¸£ºµ±±íorderdetail¡¡ÉϵÄË÷Òý²¢²»ÖØÒª£¬¡¡
¶øÇÒÒ²Óгä×ãÀíÓɲ»ÔÙÁí½¨Ë÷Òýʱ£¬ÎÒÃÇ¿¼ÂÇÒÔÏ·½Ê½£º¡¡
select¡¡distinct¡¡orders¡£custid¡¡
from¡¡orders£»¡¡
£¨select¡¡orderdetails¡£ordid¡¡
from¡¡orderdetail£»¡¡
articles¡¡
where¡¡articles¡£artid=orderdetail¡£artid¡¡
andarticles¡£artname¡¡='SOAP'£©¡¡assub_q¡¡
where¡¡sub_q¡£ordid¡¡=orders¡£ordid¡¡
and¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡59¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÕâµÚ¶þ¸ö·½·¨¶ÔË÷ÒýµÄÒªÇóÓÐËù²»Í¬£ºÈç¹ûÉÌÆ·ÊýÁ¿²»³¬¹ýÊý°ÙÍòÏ¼´Ê¹artname×Ö¶ÎÉÏûÓС¡
Ë÷Òý£¬»ùÓÚÉÌÆ·Ãû³ÆÌõ¼þµÄ²éѯÐÔÄÜÒ²²»´í¡£±íorderdetailµÄartid×ֶοÉÄÜÒ²²»ÐèË÷Òý£ºÈç¹ûÉÌ¡¡
Æ·ºÜ³©Ïú£¬³öÏÖÔÚÐí¶à¶©µ¥ÖУ¬Ôò±íorderdetailºÍarticlesÖ®¼äµÄÁ¬½Óͨ¹ý¹þÏ£»òºÏ²¢Á¬½Ó£¨merge¡¡
join£©¸ü¸ßЧ£¬¶øartid×Ö¶ÎÉϵÄË÷Òý»áÒýÆðǶÌ×µÄÑ»·¡£ÓëµÚÒ»ÖÖ·½·¨Ïà±È£¬µÚ¶þÖÖ·½·¨ÊôÓÚË÷¡¡
Òý½ÏÉٵĽâ¾ö·½°¸¡£Ò»·½Ã棬ÎÒÃÇÎÞ·¨³ÐÊÜΪ±íµÄÿ¸ö×ֶν¨Á¢Ë÷Òý£»ÁíÒ»·½Ã棬ӦÓÃÖж¼ÓС¡
һЩ¡°´ÎÒªµÄ¡±²éѯ£¬ËüÃDz»Ì«ÖØÒª£¬¶ÔÏìӦʱ¼äÒªÇóÒ²²»¿Á¿Ì£¬Ë÷Òý½ÏÉٵĽâ¾ö·½°¸ÍêÈ«Âú×ã¡¡
ËüÃǵÄÒªÇ󡣡¡
×ܽ᣺ΪÏÖ´æµÄ²éѯÔö¼ÓËÑË÷Ìõ¼þ£¬¿ÉÄܳ¹µ×¸Ä±äÏÈÇ°µÄ¹¹Ï룺Ð޸ĹýµÄ²éѯ³ÉÁËвéѯ¡£¡¡
¶à¸ö¼ä½Ó¿í·ºÌõ¼þµÄ½»¼¯¡¡
Small¡¡Intersection£»¡¡Indirect¡¡BroadCriteria¡¡
ΪÁ˹¹Ôì²éѯÌõ¼þ£¬ÐèÒªÁ¬½Ó£¨join£©Ô´±íÖ®ÍâµÄ±í£¬²¢ÔÚÌõ¼þÖÐʹÓøñíµÄ×ֶΣ¬¾Í½Ð¼ä½ÓÌõ¡¡
¼þ£¨indirect¡¡criterion£©¡£ÕýÈçÉÏÒ»½Ú¡°¶à¸ö¿í·ºÌõ¼þµÄ½»¼¯¡±µÄÇé¿ö£¬Í¨¹ýÁ½¸ö»ò¶à¸ö¿í·ºÌõ¼þµÄ¡¡
½»¼¯´¦Àí»ñȡС½á¹û¼¯£¬ÊÇÏî¼èÄѵŤ×÷£»ÈôÊÇÉæ¼°¶à´Îjoin²Ù×÷£¬»òÕ߶ÔÖÐÐÄ±í£¨centraltable£©¡¡
½øÐÐjoin²Ù×÷£¬Ôò»á¸ü¼ÓÀ§ÄÑ¡ª¡ªÕâÊǵäÐ͵ġ°ÐÇÐÎschema£¨starschema£©¡±£¨µÚ10ÕÂÏêϸÌÖÂÛ£©£¬¡¡
ʵ¼ÊµÄÊý¾Ý¿âϵͳÖо³£Óöµ½¡£¶ÔÓÚ¶à¸ö¿ÉÑ¡ÔñÐÔ²îµÄÌõ¼þ£¬Ò»Ð©º±¼ûµÄ×éºÏÒªÇóÎÒÃÇÔ¤²âÄÄ¡¡
ЩµØ·½»áÖ´ÐÐÍêÕûɨÃè¡£µ±Ç£Éæµ½¶à¸ö±íʱ£¬ÕâÖÖÇé¿öÆÄÖµµÃÑо¿¡£¡¡
DBMSÒýÇæµÄÖ´ÐÐʼÓÚÒ»¸ö±í¡¢Ò»¸öË÷Òý»òÒ»¸ö·ÖÇø£¬¾ÍËãDBMSÒýÇæÄܲ¢Ðд¦ÀíÊý¾ÝÒ²ÊÇÈç¡¡
´Ë¡£ËäÈ»Óɶà¸ö´óÐÍÊý¾Ý¼¯ºÏµÄ½»¼¯Ëù¶¨ÒåµÄ½á¹û¼¯·Ç³£Ð¡£¬µ«Ç°ÆÚµÄÈ«±íɨÃè¡¢Á½´ÎɨÃèµÈ¡¡
ÎÊÌâÒÀÈ»´æÔÚ£¬»¹¿ÉÄÜÔÚ½á¹ûÉÏÖ´ÐÐǶÌ×Ñ»·£¨nested¡¡loop£©¡¢¹þÏ£Á¬½Ó¡¡
£¨hash¡¡join£©»òºÏ²¢Á¬½Ó£¨merge¡¡join£©¡£´Ëʱ£¬À§ÄÑÔÚÓÚÈ·¶¨½á¹û¼¯µÄÄÄÖÖ±í×éºÏ²úÉúµÄ¼Ç¼Êý¡¡
×îÉÙ¡£Õâ¾ÍºÃ±È£¬ÕÒµ½·ÀÏß×îÈõµÄ»·½Ú£¬È»ºóÀûÓÃËü»ñµÃ×îÖÕ½á¹û¡£¡¡
ÏÂÃæͨ¹ýÒ»¸öʵ¼ÊµÄ¡¡Oracle¡¡°¸Àý˵Ã÷ÕâÖÖÇé¿ö¡£Ôʼ²éѯÏ൱¸´ÔÓ£¬ÓÐÁ½¸ö±íÔÚfrom¡¡×Ó¾äÖС¡
¶¼³öÏÖÁËÁ½´Î£¬ËäÈ»±í±¾Éí²»Ì«ÅӴ󣨴óµÄ°üº¬700000¡¡ÐÐÊý¾Ý£©£¬µ«´«µÝ¸ø²éѯµÄ¾Å¸ö²ÎÊý¿É¡¡
Ñ¡ÔñÐÔ¶¼Ì«²î£º¡¡
select¡¡£¨datafrom¡¡ttex_a£»¡¡
ttex_b£»¡¡
ttraoma£»¡¡
topeoma£»¡¡
ttypobj£»¡¡
ttrcap_a£»¡¡
ttrcap_b£»¡¡
trgppdt£»¡¡
tstg_a£©¡¡
from¡¡ttrcappttrcap_a£»¡¡
ttrcapp¡¡ttrcap_b£»¡¡
tstgtstg_a£»¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡60¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
topeoma£»¡¡
ttraoma£»¡¡
ttexttex_a£»¡¡
ttexttex_b£»¡¡
tbooks£»¡¡
tpdt£»¡¡
trgppdt£»¡¡
ttypobj¡¡
where¡¡£¨ttraoma¡£txnum=topeoma¡£txnum¡¡£©¡¡
and£¨ttraoma¡£bkcod¡¡=tbooks¡£trscod¡¡£©¡¡
and£¨ttex_b¡£trscod¡¡=tbooks¡£permor¡¡£©¡¡
and£¨ttraoma¡£trscod¡¡=ttrcap_a¡£valnumcod¡¡£©¡¡
and£¨ttex_a¡£nttcod¡¡=ttrcap_b¡£valnumcod¡¡£©¡¡
and£¨ttypobj¡£objtyp¡¡=ttraoma¡£objtyp£©¡¡
and£¨ttraoma¡£trscod¡¡=ttex_a¡£trscod¡¡£©¡¡
and£¨ttrcap_a¡£colcod¡¡=£º0£©¡¡not¡¡selective¡¡
and£¨ttrcap_b¡£colcod¡¡=£º1£©¡¡not¡¡selective¡¡
and£¨ttraoma¡£pdtcod¡¡=tpdt¡£pdtcod¡¡£©¡¡
and£¨tpdt¡£risktyp=trgppdt¡£risktyp¡¡£©¡¡
and£¨tpdt¡£riskflg=trgppdt¡£riskflg£©¡¡
and£¨tpdt¡£pdtcod¡¡=trgppdt¡£pdtcod¡¡£©¡¡
and£¨trgppdt¡£risktyp¡¡=£º2£©¡¡not¡¡selective¡¡
and£¨trgppdt¡£riskflg¡¡=£º3£©¡¡not¡¡selective¡¡
and£¨ttraoma¡£txnum=tstg_a¡£txnum£©¡¡
and£¨ttrcap_a¡£refcod¡¡=£º5£©¡¡not¡¡selective¡¡
and£¨ttrcap_b¡£refcod¡¡=£º6£©¡¡not¡¡selective¡¡
and£¨tstg_a¡£risktyp¡¡=£º4£©¡¡not¡¡selective¡¡
and£¨tstg_a¡£chncod¡¡=£º7£©¡¡not¡¡selective¡¡
and£¨tstg_a¡£stgnum¡¡=£º8£©¡¡not¡¡selective¡¡
ÎÒÃÇÌṩÊʵ±µÄ²ÎÊý£¨ÕâÀïÒÔ¡¡£º0¡¡µ½¡¡£º8¡¡´ú±í£©Ö´Ðд˲éѯ£ººÄʱ³¬¹ý¡¡25¡¡Ã룬·µ»Ø¼Ç¼²»µ½20¡¡
Ìõ£¬×öÁË3000¡¡´ÎÎïÀí¡¡I/O£¬·ÃÎÊÊý¾Ý¿é3¡¡000000¡¡´Î¡£ÉÏÊöͳ¼ÆÊý¾Ý·´Ó³ÁËʵ¼ÊÖ´ÐеÄÇé¿ö£¬¡¡
ÕâÊDZØÐëÊ×ÏÈÃ÷È·µÄ¡£ÏÂÃ棬ͨ¹ý²éѯÊý¾Ý×ֵ䣬µÃµ½±í¼Ç¼ÊýÇé¿ö£º¡¡
TABLE_NAME¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡NUM_ROWS¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ttypobj¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡186¡¡
trgppdt¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡366¡¡
tpdt¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡5370¡¡
topeoma¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡12118¡¡
ttraoma¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡12118¡¡
tbooks¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡12268¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡61¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ttex¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡102554¡¡
ttrcapp¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡187759¡¡
tstg¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡702403¡¡
ÈÏÕæÑо¿±í¼°±íµÄ¹ØÁªÇé¿ö£¬µÃµ½Í¼6¡2ËùʾµÄ·ÖÎöͼ£ºÐ¡¼ýÍ·´ú±í½ÏÈõµÄÑ¡ÔñÌõ¼þ£¬·½¿éΪ±í£¬¡¡
·½¿éµÄ´óС´ú±í¼Ç¼Êý¶àÉÙ¡£×¢Ò⣺ÔÚÖÐÐÄλÖõġ¡tTRaoma±í£¬¼¸ºõºÍÆäËûËùÓбíÓйØÁª¹Øϵ£¬¡¡
µ«ºÜ²»ÐÒ£¬Ñ¡ÔñÌõ¼þ¶¼²»ÔÚtTRaoma±í¡£ÁíÒ»¸öÓÐȤµÄÊÂʵÊÇ£ºÉÏÊöµÄ²éѯÓï¾äÖУ¬ÎÒÃDZØÐë¡¡
ÌṩTRgppdt±íµÄ¡¡risktyp×ֶΡ¡ºÍ¡¡riskflg×ֶεÄÖµ×÷ΪÌõ¼þ¡ª¡ªÎªÁËÁ¬½Ó£¨join£©TRgppdt±íºÍtpdt¡¡
±íҪʹÓÃÕâÁ½¸ö×ֶκÍpdtcod¡¡×ֶΡ£ÔÚÕâÖÖÇé¿öÏ£¬Ó¦¸Ã˼¿¼µ¹×ª´ËÁ÷³Ì¡ª¡ªÀýÈç°Ñ¡¡tpdt±íµÄ¡¡
×Ö¶ÎÓëËùÌṩµÄ³£Êý×ö±È½Ï£¬È»ºóÖ»´Ó¡¡trgppdt±íÈ¡µÃÊý¾Ý¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡62¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ͼ6¡2£ºÊý¾ÝµÄλÖùØϵ¡¡
¶àÊý¡¡DBMSÌṩ¡°¼ì²éÓÅ»¯Æ÷Ñ¡ÔñµÄÖ´Ðмƻ®¡±ÕâÒ»¹¦ÄÜ£¬±ÈÈçͨ¹ýexplainÃüÁîÖ±½Ó¼ì²éÄÚ´æÖС¡
Ö´ÐеÄÏîÄ¿¡£ÉÏÊö²éѯ»¨ÁË¡¡25¡¡Ã루ËäÈ»²»ÊÇÌرðÔ㣩£¬Í¨³£ÊÇÏÈÍêÕûɨÃètTRaoma±í£¬½Ó׎ø¡¡
ÐÐÒ»Á¬´®µÄǶÌ×Ñ»·£¬Ê¹ÓÃÁ˸÷ÖÖ¸ßЧµÄË÷Òý£¨ÏêÊöÕâЩË÷Òý¡¡
ºÜ·¦Î¶£¬ÎÒÃǼÙÉèËùÓÐ×ֶζ¼½¨Á¢Á˺ÏÊʵÄË÷Òý£©¡£ËÙ¶ÈÂýµÄÔÒòÊÇÍêÕûɨÃèÂ𣿵±È»²»ÊÇ¡£Îª¡¡
ÁËÖ¤Ã÷ÍêÕûɨÃèËù»¨Ê±¼äÕ¼µÄ±ÈÀýÉõ΢£¬Ö»Ðè×öÈçϼòµ¥µÄ²âÊÔ£º¶ÁÈ¡tTRaoma±íµÄËùÓмǼ£»¡¡
ΪÁ˱ÜÃâÊܵ½×Ö·ûÏÔʾʱ¼äµÄ¸ÉÈÅ£¬ÕâЩ¼Ç¼ÎÞÐèÏÔʾ¡£¡¡
ÓÅ»¯Æ÷·¢ÏÖ£ºtstg±íÓС°´óÁ¿µÐ¾ü¡±£¬¶ø²éѯÖÐÕë¶Ô´Ë±íµÄÑ¡ÔñÌõ¼þ±È½ÏÈõ£¬ËùÒÔÄÑÒÔ¶ÔËüÐγɡ°Õý¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡63¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
Ãæ¹¥»÷¡±£»¶øttrcapp±íÔÚ²éѯµÄfrom×Ó¾äÖгöÏÖÁ½´Î£¬µ«»ùÓڸñíµÄÅжÏÌõ¼þÒ²½ÏÈõ£¬ËùÒÔÒ²²»¡¡
»á´øÀ´²éѯЧÂʵÄÌáÉý£»µ«ÊÇ£¬ttraoma±íµÄλÖÃÏÔÈ»ºÜ¹Ø¼ü£¬ÇҸñí±È½ÏС£¬ÊʺÏ×÷Ϊ¡°µÚÒ»¹¥¡¡
»÷µã¡±¡ª¡ªÓÅ»¯Æ÷»áºÁ²»ÓÌÔ¥µØÕâô×ö¡£¡¡
ÄÇô£¬¼ÈÈ»¶ÔtTRaoma±íµÄÍêÕûɨÃèÎ޿ɺñ·Ç£¬ÓÅ»¯Æ÷µ½µ×´íÔÚÄÄÀïÄØ£¿Ç뿴ͼ6¡3ËùʾµÄ²éѯ¡¡
Ö´ÐÐÇé¿ö¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡64¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ͼ6¡3£ºÓÅ»¯Æ÷Ñ¡ÔñµÄÖ´Ðз¾¶¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡65¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
×¢Òâ¹Û²ìͼÖÐËùʾµÄ²Ù×÷Ö´ÐÐ˳Ðò£¬²éѯËÙ¶ÈÂýµÄÔÒòÏÔ¶ÎÞÒÅ£ºÎÒÃǵIJéѯÌõ¼þºÜÔã¸â£¬ÓÅ¡¡
»¯Æ÷Ñ¡ÔñÍêÈ«ºöÂÔËüÃÇ¡£ÓÅ»¯Æ÷¾ö¶¨ÏȶÔttraoma±í½øÐÐÍêÕûɨÃ裻½Ó×Å£¬·ÃÎʺͱíttraoma¹ØÁª¡¡
µÄËùÓÐСÐÍ±í£»×îºó£¬¶ÔÆäËû±íÔËÓÃÎÒÃǵĹýÂËÌõ¼þ¡£ÕâÑùÖ´ÐÐÊÇ´íÎóµÄ£ºËäÈ»ÓÅ»¯Æ÷¾ö¶¨Êס¡
ÏÈ·ÃÎʱíttraomaÓеÀÀí£¨¸Ã±íµÄË÷Òý¿ÉÄܷdz£¸ßЧ£¬Ã¿¸ö¼üƽ¾ù¶ÔÓ¦µÄ¼Ç¼Êý½ÏÉÙ£¬»òÕßË÷Òý¡¡
Óë¼Ç¼µÄ˳ÐòÓнϺõĶÔÓ¦¹Øϵ£©£¬µ«½«ÎÒÃÇÌṩµÄ²éѯÌõ¼þÍƳÙÖ´ÐУ¬²»ÀûÓÚ¼õÉÙÒª´¦ÀíµÄÊý¡¡
¾ÝÁ¿¡£¡¡
¼ÈÈ»ÒÑ·ÃÎÊÁËttraomaÕâ¸ö¹Ø¼ü±í£¬Ó¦¸Ã½ô½Ó×ÅÖ´ÐÐÓï¾äÖеIJéѯÌõ¼þ£¬ÕâÑù¿ÉÒÔ½èÖúÕâЩ±íÓë¡¡
ttraoma±íÖ®¼äµÄÁ¬½Ó£¨join£©ÏÈÈ¥³ýttraoma±íÖÐÎÞÓõļǼ¡ª¡ªÉõÖÁÔÚ½á¹û¼¯¸ü´óʱ£¬Èç´ËÖ´¡¡
ÐеÄЧÂÊÈԱȽϸߡ£µ«ÊÇÉÏÊöÐÅÏ¢ÎÒÃÇÖªµÀ£¬¡°ÓÅ»¯Æ÷¡±È´ÎÞ´ÓÖªµÀ¡£¡¡
ÔõÑù²ÅÄÜÆÈʹDBMS¡¡ÒÀÎÒÃÇËùÒªÇóµÄ·½Ê½Ö´ÐвéѯÄØ£¿ÒªÒÀ¿¿SQL¡¡·½ÑÔ£¨SQLdialect£©¡£ÕýÈç¡¡
Ä㽫ÔÚµÚ11Õ¿´µ½µÄ£¬¶àÊý¡¡SQL¡¡·½ÑÔ¶¼Ö§³ÖÕë¶ÔÓÅ»¯Æ÷µÄָʾ»òÌáʾ£¨hint£©£¬ËäÈ»¸÷ÖÖ·½ÑÔ¡¡
ËùÓÃÓï·¨²»Í¬£»ÀýÈ磬¸æËßÓÅ»¯Æ÷°´±íÃûÔÚfrom¡¡×Ó¾äÖгöÏÖµÄ˳ÐòÒÀ´Î·ÃÎʸ÷±í¡£²»¹ý£¬¡°Ìá¡¡
ʾ¡±µÄʵ¼ÊÓ°ÏìÔ¶±ÈËüµÄÃû×Ö°µÊ¾µÄÒª´óµÃ¶à£¬²ÉÓá°Ìáʾ¡±µÄÎÊÌâÔÚÓÚ£¬Ã¿¸öÌáʾ¶¼ÊÇÔÚ¡°¶Äδ¡¡
À´¡±¡ª¡ªÎÒÃÇÒÑÇ¿Öƹ涨ÁËÖ´Ðз¾¶£¬ËùÒÔ»·¾³¡¢Êý¾ÝÁ¿¡¢Êý¾Ý¿âËã·¨¡¢Ó²¼þµÈÒòËصķ¢Õ¹±ä»¯¡¡
¼´Ê¹²»Äܾø¶ÔÊʺÏÎÒÃǵÄÖ´Ðз¾¶£¬Ò²Ó¦¸Ã»ù±¾Êʺϡ£ÀýÈ磬¼ÈÈ»Ë÷ÒýµÄǶÌ×Ñ»·ÊÇ×î¸ßЧѡ¡¡
Ôñ£¬²¢ÇÒǶÌ×Ñ»·²»»áÒò²¢Ðл¯¶øÊÜÒ棬ÄÇôÃüÁîÓÅ»¯Æ÷°´ÕÕ±íµÄÅÅÁÐ˳Ðò·ÃÎÊËüÃǼ¸ºõûʲ¡¡
ô·çÏÕ¡£Ã÷È·Ö¸¶¨±íµÄ·ÃÎÊ˳Ðò£¬¾ÍÊÇÕâ¸ö°¸ÀýÖÐʵ¼Ê²ÉÓõķ½·¨£¬×îÖÕ²éѯ²»µ½1Ãë¼´¿ÉÍê³É£¬¡¡
²»¹ýÎïÀí¡¡I/O¡¡´ÎÊý¼õÉÙ²¢²»Ã÷ÏÔ£¨ÔÀ´3000´Î£¬ÏÖÔÚ2340´Î£¬ÒòΪÎÒÃÇÈÔÒÔttraoma±íµÄÍêÕû¡¡
ɨÃ迪ʼ£©£¬µ«Âß¼¡¡I/O¡¡´ÎÊýµÄ´ó·ù½µµÍ£¨´Ó3000000´Î½µµ½16500´Î£©Ê¹×ÜÌåÏìӦʱ¼äÏÔÖøËõ¡¡
¶Ì£¬ÒòΪÎÒÃÇ¡°½¨Ò顱Á˸ü¸ßЧµÄÖ´Ðз¾¶¡£¡¡
×ܽ᣺¼Çס£¬ÄãÓ¦¸ÃÏêϸ˵Ã÷ËùÓÐÇ¿ÆÈ¡¡DBMS¡¡×öµÄÊ¡£¡¡
ÏÔʽµØͨ¹ýÓÅ»¯Æ÷Ö¸Áָ¶¨±íµÄ·ÃÎÊ˳Ðò£¬ÊǸö±¿×¾µÄ·½·¨¡£¸üÓÅÑŵķ½·¨ÊÇÔÚfrom×Ó¾äÖС¡
²ÉÓÃǶÌײéѯ£¬ÔÚÊýÖµ±í´ïʽÖн¨ÒéÁ¬½Ó¹Øϵ£¬ÕâÑù²»±Ø´ó·ùÐÞ¸ÄSQL×