Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which is faster: Seek() or eof() in this case
Message
De
29/04/2004 04:58:05
 
 
À
29/04/2004 03:25:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00898584
Message ID:
00899236
Vues:
15


LOOKUP() is in deed not Rushmore optimizable, but if you include all four parameters, that really does not matter. Rushmore is the name for VFP's algorithm to try to select the best use of the existing indexes, but if you specify which index to use, you take over this job yourself. Since also SEEK and SEEK() requires that you have specified an index, Rushmore is per definition inactive when you use these functions/commands. At least that is how I interpret the docs.


Hi Tore, VFP docs is a start point, nothing more.

LOOKUP use a special optimization:
- if the fourth parameter exist, it have precedency,
for the third parameter it must to be a valid fieldname
- if for the third parameter exist a tag, it use the tag
- otherwise it do a linear scan like LOCATE
CREATE CURSOR myCursor (F1 C(1),F2 I,F3 Y )
INSERT INTO myCursor VALUES ('A',3,$4)
INSERT INTO myCursor VALUES ('B',2,$5)

INDEX ON F1 TAG tagF1
INDEX ON F2 TAG tagF2
INDEX ON F1+BINTOC(F2) TAG tagF1F2

?LOOKUP(F1,'A',F1)                       && THIS USE A SEEK IN THE TAG tagF1
?LOOKUP(F1,3,F2)                         && THIS USE A SEEK IN THE TAG tagF2
?LOOKUP(F1,$4,F3)                        && THIS USE A SCAN LOOKUP
? LOOKUP(F1,'A'+BINTOC(3),F3,'tagF1F2')   && THIS USE A SEEK IN THE TAG tagF1F2
? LOOKUP(F1,'A'+BINTOC(3),F4,'tagF1F2')   && error
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform