DB2 Peformance: Host Variable v/s Join
Posted: Fri Jun 25, 2010 9:22 pm
Is there any thumb rule to use host variable over joins in order to get better performance.
Please let me know which is a better option in both the Examples mentioned below
Example 1
Example 2
Please let me know if you need any other information.
Please let me know which is a better option in both the Examples mentioned below
Example 1
Select a.Col11, b.Col21, c.Col31
From
table1 a
,table2 b
,table3 c
where
a.Col12 = :WS-INPUT
and b.Col22 = :WS-INPUT
and c.Col32 = :WS-INPUT
From
table1 a
,table2 b
,table3 c
where
a.Col12 = :WS-INPUT
and b.Col22 = :WS-INPUT
and c.Col32 = :WS-INPUT
Example 2
Select a.Col11, b.Col21, c.Col31
From
table1 a
,table2 b
,table3 c
where
a.Col12 = :WS-INPUT
and b.Col22 = a.Col12
and c.Col32 = a.Col12
From
table1 a
,table2 b
,table3 c
where
a.Col12 = :WS-INPUT
and b.Col22 = a.Col12
and c.Col32 = a.Col12
Please let me know if you need any other information.