Where v. If in high hit rate tables
Posted in 1996
Hello,
The following was suggested to one of my colleagues:
Using I4GL to get rows from a large table with a high hit rate, there
is a performance advantage in moving the selection criteria from the
where clause to an if statement inside the loop.
For example,
1. Use:
declare cur1 cursor for
select f1
from table1
foreach cur1 into v1
if v1 = <condition> then
process
.
.
else
continue foreach
end if
end foreach
2. Rather than:
declare cur1 cursor for
select f1
from table1
where f1 = <condition>
foreach cur1 into v1
process
.
.
end foreach
We cannot see any advantage method 1 has over method 2.
Anybody got any ideas on this?
Thank you.
--
--------------------------------------------------------------------------
paul sellars,humberside,u.k.
==========================================================================