Joins I Class 15 t.smm.rs l s 1 t.EE ame e p Selection i cheapest access path 9 RCidbidday.name ii retrieve tuples µ 4000 Pr _100 iii apply remaining selectionditions b i get rids from all matching indexes ii intersection rids retrieve tuples f apply remaining gel and iii M Ilos unsorted logzM f M sorted logfM f M clustered M lf.M.pe logr unclustered Projection fields duplicates discard unwanted sort hash cc cost Mt 2 T after removing unwanted pages fields Joins Nested Loop Joins today Sort MergeJoing any Hash Joins interesting Every Remaining joins op agg contains a join
S.si'd SELECT R WHERE R.sid FROM S Ilos discord RHS discuss as 00 or.is f ed LoopJoims RAIS si i j outer f e R r inner s s e then add 4,57 to the result if r sj cost M Pr N FM 1000.1007500 1000 Hog 72ms 2847 YofR 11 0 row 7 LIMB Malooo R 2MB S N 5oo Swap R wish S N IOS N ps M Page orientedNested LoopJoett R page br in f S page bs in H tuple in in brr in bs tuples if to the then add Cris Sj ri result
Cost M N 1M 1000.500 117min17 1000 15017,000 smaller outer 500 1000 N M t N 500 1500,5007 IndexNestedLoopfoin tf tuple in R r s such that Si Vj probe index to fetch to result Las add 659 cost of matching tuples through the index M fending Mapp Hash index 1.2 Its Br Tree 2 4 2105 clustered 0 per page of 711 matching tuples unclustered 712 0 per marching tuple side of S hash Tdx on Saen R M f each tuple in R fetch data entry 1 2 go to file L nooo1 Mt M Ppi 1.2 1 1000.100 2.27 2240070 717mi
of B Exampk 2 site hash idx on M p 2 ssIafn T.pg.IE scam 5 Cn Fs probe hash idx 1 2 find matching tuples 2.5 248,5002 715mi Soo ooo 3 7 N Ps 1.2 2.5 2 500 N aBloonrdestedtoopJ.in S page for streaming I the inner L page for output holding bloats f outer R F of for in pages block of f K pages of R H page bs S in se pages of R H tuple r in in bs tuple s to the result if add Lois Sj ri cost M 2105 scam R outer inner for each blog of R Scam 100 pages M 1 F 500.10002 N tooo K tokio 112 500 1000 N M 500 1 µ f
asort MergeJoin on the join attribute both sorted relations sorted on join att useful both one or be sorted output should on join att may lead to bacrtraoring duplicates many sort S sort R MTN Cost if worst case Min is equal all MTN cost 2 MTN passes 2 posse fNgy Ba B N B1 O B IFNI 11 33 N 5 5 cost 1500 2 1517 17075022 05 Mt M 1 2100045151 33 buttery 1000 BN LJ w 5 N 1M 51517 00 13002 1500 1 cannot do better if than 7500ft F 100 SMJ will do low as BNLJ as 155001
Refines sort Merge Join B TN FM and B assume after poss O f ernests rm R B 7 runs a f s Born G arm B runs after pass 0 eater RS 2B runs consider replacement seat using it results vary with size 2213 to after pass 0 using replacement sort sorted runs R zMB e.BZ S B12 per file a buffer per sorted allocate we run R s O O a TI 0 a a Huff I fl II v LBK ReB 2 if dog match add to theresult 3 Mtn cost runs of R writing LBK 2 ay Read R 2 N of S writing213 2 S ray Read MTN Read Rond 5 and merge on the fly 145010 Its Mtn 3 71957
Recommend
More recommend