_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › StarJoin

Contents

1 蠍磯蓋 螳
2 ろ 譴觜
3 Star Join ろ
4 SQL Server Star Join
5 2005 vs 2008
6 SQL Server 2008 れ ろ
7 SSIS 譟壱(Lookup)覲
8 谿瑚覓語


1 蠍磯蓋 螳 #

Star Join 一危 危一れ Start Schema 貎朱Μ 譯 煙ロ 伎企. Star Join Join 襯 譴企 蟆 覈企. 谿螻 企 一危一 襷れ 谿企ゼ 覲伎碁. 谿 覈 覦炎唄碁 觜 碁 覈 豌襷 蟇, 覈 糾唄 蠍磯蓋企. 蠏碁 谿螻 瑚 螻伎 Join蟆 覃 I/O 觜覲企 Join 觜 貉れ蟆 . 讀, 谿1, 谿2, 谿3, 企 企朱 朱 一危 郁屋 蠍磯朱 れ螻 螳 豌襴 蟆企.

  1. 谿1螻 譟一
  2. 1 蟆郁骸襯 谿2 譟一
  3. 2 蟆郁骸襯 谿3 譟一

襷 企 1糾唄企朱 譟一語 豕 3 螳 . 譴螳 蟆郁骸 讌 燕 れ れ 螻 レ朱 蠍磯 襷襷豺 . 蠏碁 谿 Cross Join 蟆郁骸襯 企螻 Join る 蟆郁骸朱 譟一語 螳 譴 り 豌伎 貎朱Μ 觜 讌蟆 . Cross Join 覃 一危一 朱 襷 企讌襷 企覲企る 蠍 覓語 Cross Join 覿 覓伎[1]企 . SQL Server Star Join Hash Join 覿覿讌朱 覲企 .

Start Join る語壱危 ろる 蟯 . 襷 DBMS螳 Star Join 讌讌 る る語壱危 ろる 讌 焔レ 伎蟆 . 蠏碁覩襦 る語壱危 ろる襯 企 覦 蟲豢 DBMS Star Join 讌 覿襯 誤 覲伎 . 螳 蟆 讌 ろ 企慨.

2 ろ 譴觜 #

るゼ れ企 SSMS ろ.

star_join01.jpg

3 Star Join ろ #

朱 谿 企 覈 Cross Join .
select *
into #temp
from dbo.Dim_TestCode1
	cross join dbo.Dim_TestCode2
	cross join dbo.Dim_TestCode3
	cross join dbo.Dim_TestCode4
	cross join dbo.Dim_TestCode5

れ 2螳 貎朱Μ 觜 豸′ 覲碁.
--1
select
	a.CodeNM1
,	a.CodeNM2
,	a.CodeNM3
,	a.CodeNM4
,	a.CodeNM5
,	sum(b.Cnt*1.0)
from #temp a inner join dbo.Fact_Test b
on a.CodeKey1 = b.CodeKey1
and a.CodeKey2 = b.CodeKey2
and a.CodeKey3 = b.CodeKey3
and a.CodeKey4 = b.CodeKey4
and a.CodeKey5 = b.CodeKey5
group by 
	a.CodeNM1
,	a.CodeNM2
,	a.CodeNM3
,	a.CodeNM4
,	a.CodeNM5
order by 1,2,3,4,5


--2
select
	b.CodeNM1
,	c.CodeNM2
,	d.CodeNM3
,	e.CodeNM4
,	f.CodeNM5
,	sum(a.Cnt*1.0)
from dbo.Fact_Test a 
	inner join dbo.Dim_TestCode1 b
		on a.CodeKey1 = b.CodeKey1
	inner join dbo.Dim_TestCode2 c
		on a.CodeKey2 = c.CodeKey2
	inner join dbo.Dim_TestCode3 d
		on a.CodeKey3 = d.CodeKey3
	inner join dbo.Dim_TestCode4 e
		on a.CodeKey4 = e.CodeKey4
	inner join dbo.Dim_TestCode5 f
		on a.CodeKey5 = f.CodeKey5
group by 
	b.CodeNM1
,	c.CodeNM2
,	d.CodeNM3
,	e.CodeNM4
,	f.CodeNM5
order by 1,2,3,4,5
star_join02.jpg

れ ろ螻 覲伎企 螳 貎朱Μ 觜谿願 覦. 豌 豌襴螳 襷 谿企. 豌 覯讌 貎朱Μ 蟆曙 5豐 豌襴螳 覈朱 覯讌 貎朱Μ 20豐螳 . ろ碁 2005覯 蟆伎襷 蠍磯蓋 螳 ろ語企襦 朱 Star Join 螳企手 螳覃 . SQL Server Star Join れ 瑚.

4 SQL Server Star Join #

2005 Star Join覲企 2008 Star Join 螳. SQL Server Star Join "Bitmap Filtering 伎 貎朱Μ 螻 豕"企. Bitmap Filtering 螳 れ螻 螳.

Bitmap Filtering
Bitmap Index 讌襷 Bitmap Filter 覃覈襴 蟲譟一牡企襦 DML 朱 誤 碁煙 讌蟯襴 るる螳 . Bitmap Filter 譯 朱 貎朱Μ 豌襴 螳 覩語 レ 豕覃伎 朱 焔. 伎 覲譟一語 覲 貎朱Μ 螻襷 . 蠏碁覩襦 伎 覲譟一語 襷れ 讌 譟郁唄襷 . (襯 れ equal join 襷 .)

Optimized Bitmap Filtering
貎朱Μ 螻 豕 蟇磯 貎朱Μ 螻 譴 牛磯伎 朱 蟆曙 豕 觜碁У 謂手 . 豕 觜碁У 磯 伎 譟一語 覲貎朱Μ 螻 .

5 2005 vs 2008 #

2005覯 Table Scan 一一 煙 覲企 企 覦 譟郁唄螳 .
star_join03.jpg
star_join04.jpg

2008 豕 觜碁У 一一螳 讓 谿 企 碁Μ 朱 Table Scan 一一 煙 覲企 企 碁Μ (觜碁У 蟆)螳 企 碁Μ 讌 豌 覯讌 譟一 伎 企 覦 .

star_join05.jpg
star_join06.jpg
star_join07.jpg

豕 觜碁У 蟲(襷 伎)
  • 企 豕 100伎螳 伎 . 豕 襦蠏碁 企慨 企 谿 企襦 螳譯狩.
  • 企螻 谿 企 螳 企 譟一碁 螻る.
  • 企螻 谿 企 螳 譟一 譟郁唄 譟一語伎伎 讌襷 蠍磯蓋 -碁 蟯螻 給. 蠍磯 伎 碁.
  • 谿 譟一語 谿 豺企襴郁 企 豺企襴磯慨 襷 螻る.

6 SQL Server 2008 れ ろ #

れ襦 PC ろ碁ゼ 企慨. 蟆郁骸 るる暑. 豕 Bitmap Filtering 覿蟲螻 れ襦 谿企ゼ 覲伎伎 . ろ Star Join 螳襦 蟆曙一 豌 豌襴 螳 レ . 豌襴 豌 覯讌 貎朱Μ螳 5豐願, 覯讌 貎朱Μ 20豐. 2005 觜 2008 Star Join 焔レ レり . れ ろ螻 觜 譴讌襷 れ襦 覲襦 焔レ レ蟇 螳讌 . 覦 覘 <; 譬 ろ碁ゼ 企 .

star_join08.jpg

れ 豕 觜碁У 磯 蟆 誤 蟆企.
star_join09.jpg

7 SSIS 譟壱(Lookup)覲 #

觜訣 覦覯朱 SSIS 譟壱覲 . 豌 覲伎 蠏碁殊 螳企一 企(Fact_Test) 觜り 螳企慨.

star_join01.jpg

螳 Flat(1豌 襷 蟇) 螳讌螻 朱, Flat 殊 一危磯ゼ 企 曙伎 り 螳企慨.

flat_file.jpg

企 一危磯ゼ j鍵 覦覯 螳讌讌襷 SQL 伎 kる れ螻 螳 SQL 燕伎 蟆企.
INSERT dbo.Fact_Test
SELECT 
	b.CodeKey1
,	c.CodeKey2
,	d.CodeKey3
,	e.CodeKey4
,	f.CodeKey5
,	[0]
FROM OPENROWSET(
		'MSDASQL'
	,	'Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=C:\Documents and Settings\dwa2007\覦覃;'
	,	'select  * from 豌襷蟇.txt') a inner join Dim_TestCode1 b
on a.貊= b.CodeNM1 inner join Dim_TestCode2 c
on a.貊= c.CodeNM2 inner join Dim_TestCode3 d
on a.貊= d.CodeNM3 inner join Dim_TestCode4 e
on a.貊= e.CodeNM4 inner join Dim_TestCode5 f
on a.貊= f.CodeNM5

るジ 覦覯朱 SSIS 譟壱 覲 伎 一危磯ゼ 曙 蟆企.

lookup.jpg

覦覯 觜蟲 焔 觜蟲螳 .

襦覦CPU襯
朱SQL襦: 5覿 40豐, 貉る: 4覿43豐 30%
SSIS Lookup襦: 1覿, 貉る: 4覿 58豐 40 ~ 50%
* 貉る螳 蠏碁殊 蟯螻襯 讌 谿語^覓願屋 豌危襯 蠍 覓語.
* 蟯螻襯 朱 貉る螳 蟆.

觜襯願 襦り 蠎 SSIS襯 伎 蟆 譬る 蟆 . 讌覲伎 觜螻 襦 伎 伎 螳 蠍 覓語 磯殊 螳覦 觜 殊 .
----
   [1]  OLTP 貎朱Μ ろ觜 螳伎 . 伎螻螳 覲願朱 蟆 螳伎 .
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

蠍 襤壱 るジ 襤壱 .