Stuart Tinto
New Member
I have a piece of code
Which takes around 5 seconds to run, however when I change it to:
The run time jumps dramatically to around the 90 second mark.
the fields company, acc_id, arr_id and del on table2 are all single component indexes.
I am surprised at just how much longer the query takes as I would have thought that each itteration of the for each table1 loop would only have to resolve a single for first on table2
Any ideas or am I just missunderstanding how indexing should work?
Thanks in advance
Stuart
Code:
for each table1
where table1.company = 1
and table1.deleted = false
and table1.cancelled = false
and table1.broken = false no-lock:
end.
Which takes around 5 seconds to run, however when I change it to:
Code:
for each table1
where table1.company = 1
and table1.deleted = false
and table1.cancelled = false
and table1.broken = false no-lock,
first table2
where table2.company = 1
and table2.acc_id = table1.acc_id
and table2.arr_id = table1.arr_id
and table2.del = false no-lock:
end.
the fields company, acc_id, arr_id and del on table2 are all single component indexes.
I am surprised at just how much longer the query takes as I would have thought that each itteration of the for each table1 loop would only have to resolve a single for first on table2
Any ideas or am I just missunderstanding how indexing should work?
Thanks in advance
Stuart