Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it reasonable to have index on DELETED()?
Message
De
22/03/1999 14:18:38
Walter Meester
HoogkarspelPays-Bas
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00196021
Message ID:
00200605
Vues:
12
Cristof,

>If you look at this from a theorecticly point of view there is NO way that a TAG on delete could benefit performance if there are no deleted records.

>But here you are wrong. When you have SET DELETED ON, VFP has to read every record and check the deleted state (that's the first byte in the record).

When there are no deleted records, VFP has to read the records anyway because it has to process the record (E.g:copy them into the cursor), whether there is or is no tag on deleted().

Whether this decreases performance or not, depends on a number of things:

>1. How much time does this checking need compared with the time to create a bitmap? Here take into account that a bitmap has only to be generated once, while checking is performed every time.

Could you explain this a little better ? a (index) bitmap ?

>2. Would VFP have to read all records anyway? If it would read them, there's indeed little performance difference. If not, reading all records decreases speed drastically. It hasn't got to read them when you create a filtered table, or when you issue a command that doesn't process all selected records (for example the grid or BROWSE).

If the optimizer determines that there are no deleted records, it returns the whole table as a recordset, after which VFP has to read the actual records anyway. The would be NO speed improvement because the index didn't make the selection any smaller than the table itself.

>3. How much of the record are you reading. If you are only reading a few fields, VFP might only read that part from the table. If VFP has to check for the deleted state it has to read that part, too. This means that it either reads a huge portion of the record, or the number of requests to the server doubles.

If you use the index on deleted() VFP has to read more info because it has to read the index and the actual table as well.

As the OS reads just clusters it has to read the whole record. VFP cannot optimize queries by only reading parts of records. Only when you've very small clusters in combination with very wide tables it could be theorecticly done.

>4. Do you issue commands that move the record pointer. LOCATE/CONTINUE for example. If you have an index on DELETED(), VFP knows that the record is not deleted and can retrieve the record when you need it. Otherwise it has to read the record right away.

What's the difference ? With the deleted record it has first to check that the record is not deleted and only after this it reads the record.

If there is no index it reads the record right away and is therefor faster than the former as it don't have to check.


Walter,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform