Hello,
Which has better performance for large volumes?
while
..
..
end while
or
forentity
..
..
endfor------------------------------
Edson Gomems
Analyst
Coamo -Coop. Agropecuaria Mouraoense
------------------------------
Hello,
Which has better performance for large volumes?
while
..
..
end while
or
forentity
..
..
endforHello,
Which has better performance for large volumes?
while
..
..
end while
or
forentity
..
..
endforI doubt there would be much difference between the two sets of ProcScript commands per se, but if you're processing all occurrences and not making database updates then forentity would probably be better than a while loop with additional setocc commands. However, more importantly, you don't want to use discard in a forentity loop as it will make the next occurrence active which could result in occurrences being skipped, and when making updates to a large number of records it is usually more performant to store updates to records in smaller batches.
Hello,
Which has better performance for large volumes?
while
..
..
end while
or
forentity
..
..
endforHi Edson,
It depends on what you'd like to do....
BUT
If you need to process a large number of records there are a number of factors you need to consider;
Do you need to keep the records in memory? If so, if the dataset is large enough, you'll run out of memory...
(at least, on a 32 bit Uniface version).
You can resolve this by using discard - in which case the "while" construct is probably your best bet.
The 2nd thing you might want to consider is to use a raw 'sql/data' statement - and do a forlist on the
data in $result. There doesn't seem to be a limit on the size of data returned in $result (according to
the manual) - I guess the best way is to try and see... ;-)
I have done this latter part a number of times...
For Oracle "select 'transaction_id='||transaction_id,'transaction_amount='||transaction_amount etc etc"
When I get the dataset back I've used
forlist record in list
creocc "DUMMY", -1
record = $replace(record, 1, ",", "<gold sep", -1)
getlistitems/occ record, "DUMMY"
endfor
Of course you can go any which direction with this as well...
HTH,
Knut
Hi Edson,
It depends on what you'd like to do....
BUT
If you need to process a large number of records there are a number of factors you need to consider;
Do you need to keep the records in memory? If so, if the dataset is large enough, you'll run out of memory...
(at least, on a 32 bit Uniface version).
You can resolve this by using discard - in which case the "while" construct is probably your best bet.
The 2nd thing you might want to consider is to use a raw 'sql/data' statement - and do a forlist on the
data in $result. There doesn't seem to be a limit on the size of data returned in $result (according to
the manual) - I guess the best way is to try and see... ;-)
I have done this latter part a number of times...
For Oracle "select 'transaction_id='||transaction_id,'transaction_amount='||transaction_amount etc etc"
When I get the dataset back I've used
forlist record in list
creocc "DUMMY", -1
record = $replace(record, 1, ",", "<gold sep", -1)
getlistitems/occ record, "DUMMY"
endfor
Of course you can go any which direction with this as well...
HTH,
Knut
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.