Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting a certain range of an ordered query
Message
 
 
À
08/02/2001 06:23:59
Marco Beuk
Innovero Software Solutions
The Hague, Pays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00473835
Message ID:
00473851
Vues:
17
Hi!

You can organize such functionality for remote views only using properties of remote view cursors like 'FetchSize'. You can do this for VFP database by connecting to in through ODBC using remote view. I don't know, however, if it will work, but probably if yes - than it should have the best performance for your case.

Another approach have less performance but might be good for you because it is more simple.
Get 50,000 records from server, BUT, get only ID values of records. Thus despite 50000 records you will take little of data from server, though you will scan entire data table at the server that miight have bad performance anyway (test this in simple query to the database on the network before implemnenting this approach). Than, using ID values, you can make a manual fetching - having keyset you can get any data you want using key values from the keyset. Thus, navigate on keyset, but get data into separate cursor to display using query like following:

SELECT TOP * FROM Address WHERE Place = m.Place AND m.RecordID IN (&MyIDS) ORDER BY Name

and fill in MyIDS variable befre this query by 10 ID values - '10,344,23456,2134,...'

HTH.

>I want to select a certain range (10 records) from a large table (500000 records).
>Two fields of the table are Name and Place.
>Users can select a place and they will get the results ordered by name. I won't, however, show the entire resultlist but just the top 10 records:
>
>SELECT TOP 10 * FROM Address WHERE Place = m.Place ORDER BY Name
>
>Ommitting TOP 10 here could result in up to 50000 records.
>The user can now click on a Next-button to see the next 10 records, that is the 11nth - 20th record.
>
>Does anyone know a way to do this in a SQL select without loosing to much of the performance?
>
>Marco.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform