Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I index
Message
De
07/07/1999 10:40:27
 
 
À
06/07/1999 23:33:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00238097
Message ID:
00238284
Vues:
11
With rushmore optimization, it won't be too bad if you have an index created on each field. If speed was _really_ an issue, I would do it this way:
index on iif(active, "Y", "N") + name tag searchkey
lcsearchexpr = "Y" + myname
seek lcsearchexpr
But if speed was important, but you could stand to have to queries take a second or two each, I would make seperate tags. They are easier to maintain, I think.
index on active tag active
index on name tag name
set filter to active
seek myname
With the index on active, the set filter command will be very fast!


>I have a table with fields including a date field, a character field and a logical field that stores the deleted status of the record - .T. = current, .F. = Deleted.
>id = N(10)
>Char = Name C(30)
>Date = Birth date D(8)
>Active = L(1)
>among other fields
>
>When changes are made to a record a new record is created with the changes, Active = .T. and the active = .f. for the old record. Thus we have an audit trail of changes.
>
>How do I create an index on the character field so as to SEEK only those that are active.
>
>I use Locate for name = "MYNAME" and ACTIVE = .T. but this is too slow. I need SEEK so how do I create an index for this??
>
>Set filter to ACTIVE = .T. is also too slow. There are > 250000 records (including the non active ones)
>
>I need to
>
>Set ORDER to TAG myindextag
>and
>SEEK "MYNAME" which will give me an active record.
>
>Bernard
--Todd Sherman
-Wake Up! Smell the Coffee!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform