Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
New to Views
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00459334
Message ID:
00459392
Vues:
26
Excellent post, thank you.

>If no ORDER BY clause is used then you get all records matching the WHERE criteria in the natural order of the table.
>
>FoxPro uses a binary tree format for its indexes. This means that equal values are always added to the right. Rushmore uses the indexes to retrieve a bitwise variable that specifies which records are to be returned. This variable is built using the natural order of the table because an index is built by scanning the table and adding new index nodes in the appropriate place (to the left if < and to the right >=).
>
>Ex.
>              E
>             /  \
>            C    L
>           / \     \
>          A   C     M
>               \
>                C
>Taking the above tree representation, the specifics are:
>Record      Value      Secondary Field
>1             E             6
>2             L             9
>3             C            10
>4             A             3
>5             C             2
>6             M            16
>7             C             1
>If you do a simple select on value = "C" without an order by clause, nodes 3, 5 and 7 will be returned in the following representation:
>0010101
>
>VFP will build a cursor based on that representation. If you specify an order by clause (e.g. on the secondary field) then VFP has to go through an extra operation to sort the previosly built cursor on the new expression.
>
>FWIW, SQL Server is the same way. Bring up the Execution Plan in Query Analyzer and you can see the extra step visually represented.
Chris McCandless
Red Sky Software
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform