Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>>I can not see what causes your problem, but I have a few advices:
>>>1. Avoid SET FILTER whenever possible, instead you can use "BROWSE FOR yourcondition"
>>
>>BROWSE FOR is equal to SET FILTER. What are you referring to?
>
>Over the years I have had many problems when I used SET FILTER, so I stopped using it whenever I could. One problem was that it is easy to forget to reset it, and you end up with too few records. I don't remember the other problems, but since it's usually easier to add a FOR whatevercondition, I prefer that.
>
>>>2. Don't use GO TOP after SET FILTER, instead use LOCATE which in many cases is extremely much faster
>>
>>That's for sure!
It occurred to me there may be a performance benefit in this as well. It's not much, but...
USE members
LOCAL m.lnA, m.lnX
m.lnA = SECONDS()
FOR m.lnX = 1 TO 10000
SET FILTER TO UPPER(SURNAME)="Z"
SCAN
ENDSCAN
NEXT m.lnX
?SECONDS() - m.lnA
m.lnA = SECONDS()
FOR m.lnX = 1 TO 10000
SCAN FOR UPPER(SURNAME)="Z"
ENDSCAN
NEXT m.lnX
?SECONDS() - m.lnA
Gives me .349 seconds for the first block and .184 seconds for the second. No need for the LOCATE in the first as the SCAN does that.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement