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

MS SQL ²éѯÁª½ÓÔËËãϵÁУ­£­¹þÏ£Áª½Ó£¨Hash Join)

¹þÏ£Áª½ÓÊǵÚÈýÖÖÎïÀíÁª½ÓÔËËã·û£¬µ±Ëµµ½¹þÏ£Áª½Óʱ£¬ËüÊÇÈýÖÖÁª½ÓÔËËãÖÐÐÔÄÜ×îºÃµÄ£®Ç¶Ì×Ñ­»·Áª½ÓÊÊÓÃÓÚÏà¶Ô½ÏСµÄÊý¾Ý¼¯£¬¶øºÏ²¢Áª½ÓÊÊÓÃÓÚÖеȹæÄ£µÄÊý¾Ý¼¯£¬¶ø¹þÏ£Áª½ÓÔòÊÊÓÃÓÚ´ó¹æÄ£Áª½ÓµÄÊý¾Ý¼¯£®
¹þÏ£Áª½ÓËã·¨²ÉÓ㢹¹½¨£¢ºÍ£¢Ì½²â£¢Á½²½À´Ö´ÐУ®ÔÚ£¢¹¹½¨£¢½×¶Î£¬ËüÊ×ÏÈ´ÓµÚÒ»¸öÊäÈëÖжÁÈ¡ËùÓÐÐУ¨³£½Ð×ö×ó»ò¹¹½¨ÊäÈ룩ÔÚÏàµÈÁª½Ó¼üÉ϶ÔÕâЩÐнøÐйþ
Ï££¬È»ºóÔÚÄÚ´æÖд´½¨¹þÏ£±í£¬ÔÚ£¢Ì½²â£¢½×¶Î£¬´ÓµÚ¶þ¸öÊäÈëÖжÁÈ¡ËùÓÐÐУ¨³£½Ð×öÓÒÖÐ̽²âÊäÈ룩ÔÚÏàµÄµÈÖµÁª½Ó¼üÉ϶ÔÕâЩÐнøÐйþÏ££¬²éÕÒ¿É̽²â¸Ã¹þÏ£±í
ÖÐÆ¥ÅäµÄÐУ®
ÏÂÃæÊÇα´úÂëÃèÊö£º
for each row R1 in the build table
begin
calculate hash value on R1 join key(s)
insert R1 into the appropriate hash bucket
end
for each row R2 in the probe table
begin
calculate hash value on R2 join key(s)
for each row R1 in the corresponding hash bucket
if R1 joins with R2
output (R1, R2)
end
ʾÀý£º
´´½¨±í¶ÔÏó¼Ü¹¹£º
create table T1 (a int, b int, x char(200))
create table T2 (a int, b int, x char(200))
create table T3 (a int, b int, x char(200))
set nocount on
declare @i int
set @i = 0
while @i < 1000
begin
insert T1 values (@i * 2, @i * 5, @i)
set @i = @i + 1
end
GO
declare @i int
set @i = 0
while @i < 10000
begin
insert T2 values (@i * 3, @i * 7, @i)
set @i = @i + 1
end
GO
declare @i int
set @i = 0
while @i < 100000
begin
insert T3 values (@i * 5, @i * 11, @i)
set @i = @i + 1
end
GO
ÏÖÔÚÖ´ÐÐÒÔϲéѯ£º
set statistics profile on
select *
from T1 join T2 on T1.a = T2.a
set statistics profile off
Ö´ÐÐÉÏÊö²éѯµÃµ½Èçϲéѯ¼Æ»®£º
[img=550,189 alt=]http://www.haixiait.com/attachments/month_0804/v200841125633.JPG[/img]

´ÓÊä³öÐÅÏ¢Á˽⵽£¬T2±íÊÇT1±íµÄ£±£°±¶£¬¶ø²éѯÓÅ»¯Æ÷ÔòÑ¡ÔñT1±í×÷Ϊ£¢¹¹½¨£¢±í£¬T2±í×÷Ϊ£¢Ì½²â£¢±í£®
ÏÂÃæÀ´¿´Ò»ÏÂÈý¸ö±íµÄÁª½Ó£º
set statistics profile on
select *
from (T1 join T2 on T1.a = T2.a)
join T3 on T1.b = T3.a
set statistics profile off
Ö´ÐÐÉÏÊö²éѯµÃµ½Èçϼƻ®£º  
[img=550,191 alt=]http://www.haixiait.com/attachm


Ïà¹ØÎĵµ£º

³£ÓÃSQLÓï¾ä£¨Oracle£©(ת)

ORACLEÖÐ×ֶεÄÊý¾ÝÀàÐÍ
   ×Ö·ûÐÍ    char        ·¶Î§  ×î´ó2000¸ö×Ö½Ú ¶¨³¤
               char(10)   'ÕÅÈý' ºóÌí¿Õ¸ñ6¸ö°Ñ10¸ö×Ö½Ú²¹Âú  'ÕÅÈý &nb ......

sql server 2005 Óû§È¨ÏÞ

ÒªÏë³É¹¦·ÃÎÊ SQL Server Êý¾Ý¿âÖеÄÊý¾Ý£¬ÎÒÃÇÐèÒªÁ½¸ö·½ÃæµÄÊÚȨ£ºÒ»¡¢»ñµÃ×¼ÐíÁ¬½Ó SQL Server ·þÎñÆ÷µÄȨÀû£»¶þ¡¢»ñµÃ·ÃÎÊÌض¨Êý¾Ý¿âÖÐÊý¾ÝµÄȨÀû£¨select, update, delete, create table ...£©¡£¼ÙÉ裬ÎÒÃÇ×¼±¸½¨Á¢Ò»¸ö dba Êý¾Ý¿âÕÊ»§£¬ÓÃÀ´¹ÜÀíÊý¾Ý¿â mydb¡£
1. Ê×ÏÈÔÚ SQL Server ·þÎñÆ÷¼¶±ð£¬´´½¨µÇ½ÕÊ»§£¨creat ......

ÈçºÎ¼ì²éSQL Server ÄÚ´æÆ¿¾±

 DBCC memorystatus
 --²éѯ»º³åÇø³ØÏûºÄµÄÄÚ´æ×ÜÁ¿°üÀ¨AWE
 
 SELECT
 SUM(multi_pages_kb+virtual_memory_committed_kb+shared_memory_committed_kb+
 awe_allocated_kb) AS [Used by BPool, kb]
 from sys.dm_os_memory_clerks WHERE type='MEMORYCLERK_SQLBUFFERPOOL'
&nb ......

¾«ÃîSQLÓï¾äÊÕ¼¯

                                                    ¾«ÃîSQLÓï¾äÊÕ¼¯ 
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿âCREATE DATABASE database-name 2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿âdrop database dbn ......

PowerDesignerÉú³ÉSQL½Å±¾Ê±±íÃû¡¢×Ö¶ÎÃû´øÒýºÅÎÊÌâ

 
 
 
PowerDesignerÉú³ÉSQL½Å±¾Ê±±íÃû¡¢×Ö¶ÎÃû´øÒýºÅÎÊÌâ
 
    Ê¹ÓÃPowerDesignerÉú³ÉÊý¾Ý¿â½Å±¾Ê±£¬±íÃûÒ»°ã»á´øÒýºÅ¡£ÈçÏ£º
¼ÓÒýºÅÊÇPL/SQLµÄ¹æ·¶£¬Êý¾Ý¿â»áÑϸñ°´ÕÕ“”ÖеÄÃû³Æ½¨±í£¬Èç¹ûûÓГ”£¬»á°´ÕÕORACLEĬÈϵÄÉèÖý¨±í£¬Ä¬ÈÏÊÇÈ«²¿´óд£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ