Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting X TOP records
Message
From
11/10/2004 11:51:53
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00950435
Message ID:
00950453
Views:
11
The index won't be used for the ORDER BY, but to resolve a JOIN or WHERE clause. ORDER BY is applied to the result set after the data has been selected. You can speed up the query by applying a WHERE condition so that the entire table isn't ordered or by using fewer fields instead of all of them.

>Am I correct in assuming that when you use SQL Select, the TOP syntax is not optimized for an index?
>
>I have a table MYORDERS with field ORDERNO that has index tag.
>
>When I try:
>
>
>select top 10 * from MYORDERS order by ORDERNO
>
>
>The query takes considerable time. I can sort of "see" that VFP selects all records and then selects 10 from the top. Is there a way to make this query run faster?
>
>Thank you.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform