gauthaman_mech Beginner
Joined: 10 Apr 2005 Posts: 12 Topics: 5 Location: India
|
Posted: Wed Sep 20, 2006 3:04 pm Post subject: joins vs looping in a cobol program |
|
|
I have a requirement in which there are 4 tables: Policy, state, location and coverage. The relationship is a polciy can have multiple states and each state can have multiple locations and each location can have multiple coverages.
I want some data from all tables.
The primary condition is that I want only certain coverges, hence my where clause is on the coverage table.
Which one will be better in performance
1. A nested join to get the data, or,
2. A cursor first to get specific coveages and then loop it in the program to get the data from the remaining tables.
My understanding is joins are effective only when the condition is applied on the parent table. If we use a join here I think that first all possible combinations will be feteched from on which the where condition will be applied.
I am correct or a join is always the best option.
Thanks in advance |
|