Need help for optimization

BlyBly Registered User

Hi there.

I have a question regarding join optimization :

I have 2 data sets, DS1 and DS2, with lot of columns and I only need four of them from DS2.

Is it better to do :

Select DS1.*, DS2.Var1, DS2.Var2, DS2.Var3, DS2.Var4
from DS1 as DS1
left join DS2 as DS2
on DS1.Var1 = DS2.Var1 and DS1.Var2 = DS2.Var2 and DS1.Var3 = DS2.Var3

OR

Select DS1.*, DS2.Var1, DS2.Var2, DS2.Var3, DS2.Var4
from DS1 as DS1
left join (select Var1, Var2, Var3, Var4 from DS2) as DS2
on DS1.Var1 = DS2.Var1 and DS1.Var2 = DS2.Var2 and DS1.Var3 = DS2.Var3

?

Many thanks in advance

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file