BobyIsProgress
Member
Hello,
While doing a new project I was testing something on performance, there is two way I tried:
It appears that the traditionnal FOR EACH block was much faster (around 3 seconds less) than the QUERY strucutre.
I don't understand why?
Did someone as an explanation ?
For me the QUERY should be faster because I ask 2 less fields, so less data to be pulled. But maybe I mistake things.
Thanks in advance
BobyIsProgress
While doing a new project I was testing something on performance, there is two way I tried:
I used CUSTOMER table as exemple, but for my case I have a table with 30 fields and only need 6 of them. Also I'm reading around 6K records.Code:// Way 1 FOR EACH CUSTOMER NO-LOCK: DISPLAY CUSTOMER.custnum CUSTOMER.custlib SKIP. END. // Way 2 DEFINE QUERY cust FOR CUSTOMER FIELD (custnum custlib). OPEN QUERY cust FOR EACH CUSTOMER NO-LOCK. GET FIRST cust. DO WHILE AVAILABLE CUSTOMER: DISPLAY CUSTOMER.custnum CUSTOMER.custlib SKIP. GET NEXT cust. END.
It appears that the traditionnal FOR EACH block was much faster (around 3 seconds less) than the QUERY strucutre.
I don't understand why?
Did someone as an explanation ?
For me the QUERY should be faster because I ask 2 less fields, so less data to be pulled. But maybe I mistake things.
Thanks in advance
BobyIsProgress