Link to home
Get AccessLog in
Avatar of Rocking Buddy
Rocking BuddyFlag for India

asked on

Preformance impact - mulitple or single column in join

Hi,


I have query which needs to be joined with four column of differnt data type like int, varchar & char. At the time of join have to write the four in and condition.

Can we have a single column wherein all the four column values can be added and this column can be used in the join condition. Now join will have only one single column.


Will this have some performance improvement instead of using four different columns?

Avatar of Am P
Am P
Flag of India image

greetings.

possible for you to share the query ? You can change the tables to table1 and columns to col1 etc.
Avatar of Rocking Buddy

ASKER

select t1.col1,t2.col2 from table1 t1
join table2 t2 on
t1.col1 = t2.col1 and
t1.col2 = t2.col2 and
t1.col3 = t2.col3 and
t1.col4 = t2.col4 and

or
in databse col5 is concat(col1,col2,col3,col4)

select t1.col1,t2.col2 from table1 t1
join table2 t2 on
t1.col5 = t2.col5
ASKER CERTIFIED SOLUTION
Avatar of Bitsqueezer
Bitsqueezer
Flag of Germany image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
SOLUTION
Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
SOLUTION
Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access