SQLÖ÷¼üС½á
SQL ÖеÄÖ÷¼üµÄ×÷ÓÃ:
Äܹ»Î¨Ò»±íʾÊý¾Ý±íÖеÄÿ¸ö¼Ç¼µÄ¡¾×ֶΡ¿»òÕß¡¾×ֶΡ¿µÄ×éºÏ¾Í³ÆΪÖ÷Âë(Ö÷¼ü)¡£
×÷ÓÃ
1¡¢Ö÷¼üΨһµÄʶ±ðÿһ¼Ç¼;
2¡¢Ö÷¼ü½«¼Ç¼ºÍ´æ·ÅÔÚÆäËû±íÖеÄÊý¾Ý½øÐйØÁª¡£ÔÚÕâÒ»µãÉÏ£¬Ö÷¼üÊDz»Í¬±íÖи÷¼Ç¼֮¼äµÄ¼òµ¥Ö¸Õë¡£
ÈôÓÐÁ½¸ö±íA£¬B£¬keyÊÇAµÄÖ÷¼ü£¬¶øBÖÐÒ²ÓÐkey×ֶΣ¬Ôòkey¾ÍÊDZíBµÄÍâ¼ü¡£
A£¬B¿ÉÒÔͨ¹ýkey½øÐйØÁª¡£
³ýÁËÒÔÉÏ˵µÄ, ÎÒ½ñÌì²âÊÔÖÐ, ·¢ÏÖÓкܶàÊý¾Ýʱ, »¹¿ÉÒÔ¼Ó¿ì²éѯËÙ¶È! ¶øÇÒËٶȺÜÃ÷ÏÔµÄ!
ÓÐЩ֪ʶ, Ö»ÊÇѧÁË, ¾ßÌåÊÇ·ñÊÇÕâÑù, Ö»ÊǸÐÐÔÈÏʶ, ¾¹ýʵ¼ù·¢ÏÖ, ¾ÍÓÐÁËÀíÐԵļÇÒä, ¶ÔÓÚÔõôÑù¼Ó¿ìsqlµÄ²éѯËÙ¶È, ¸ÄÌìÔÙÑо¿!
Ïà¹ØÎĵµ£º
½ñÌì×öSQL ÓÅ»¯£¬²éÕÒÖ´Ðмƻ®Ê±£¬Ö´Ðмƻ®£¬·¢ÏÖ´ËÖ´Ðмƻ®ÓëÒÔÍùµÄ¼Æ»®ÓÐËùÇø±ð£»ÕÒ¼»¥ÁªÍø£¬ÖÕÓÚÕÒһƪÓйØÑо¿±È½ÏÉîÈëµÄÎÄÕ£»
ÔÖ´Ðмƻ®Ê¹ÓõÄÊÇË÷ÒýɨÃ裬ͻȻһÏ»áʹÓÃË÷Òý¸²¸Ç¼¼Êõ£¬Ð§ÂÊ´óÔö£»
SELECT * µÄÕæÏࣺË÷Òý¸²¸Ç(index coverage)
SELECT *µÄЧÂʺÜÔã¸âÂ𣿵±È»£¬ËùÓÐÈ˶¼ÖªµÀÕâÒ»µã£¬µ«ÊÇΪʲôÄØ£ ......
¾ßÌå³ö´¦²»Ïê¡£
ÈçºÎÈÃÄãµÄSQLÔËÐеøü¿ì
---- ÈËÃÇÔÚʹÓÃSQLʱÍùÍù»áÏÝÈëÒ»¸öÎóÇø£¬¼´Ì«¹Ø×¢ÓÚËùµÃµÄ½á¹ûÊÇ·ñÕýÈ·£¬¶øºöÂÔÁ˲»Í¬µÄʵÏÖ·½·¨Ö®¼ä¿ÉÄÜ´æÔÚµÄÐÔÄܲîÒ죬ÕâÖÖÐÔÄܲîÒìÔÚ´óÐ͵ĻòÊǸ´ÔÓµÄÊý¾Ý¿â»·¾³ÖУ¨ÈçÁª»úÊÂÎñ´¦ÀíOLTP»ò¾ö²ßÖ§³ÖϵͳDSS£©ÖбíÏÖµÃÓÈΪÃ÷ÏÔ¡£±ÊÕßÔÚ¹¤×÷ʵ¼ùÖз¢ÏÖ£¬²»Á¼µÄSQLÍùÍùÀ´×ÔÓÚ² ......
http://technet.microsoft.com/zh-cn/magazine/2008.04.blocking.aspx
SQL Server
×î´ó³Ì¶È½µµÍ SQL Server ÖеÄ×èÈû
Cherié Warren
¸ÅÀÀ:
·¢ÉúËøÉý¼¶µÄÔÒò
±ÜÃâ²»±ØÒªµÄ×èÈû
ÓÅ»¯²éѯ
¼àÊÓËø¶¨¶ÔÐÔÄܵÄÓ°Ïì
Ëø¶¨¶ÔÖ§³ÖÊý¾Ý¿âµÄ²¢·¢¶Áд»î¶¯¶øÑÔÊDZØÐèµÄ£¬µ«×èÈûÈ´»á¶ÔϵͳÐÔÄܲúÉú¸ºÃæÓ°Ï죬 ......
»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊ ......