Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL select is slow in large tables
Message
From
20/06/1998 19:07:37
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
19/06/1998 12:39:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00109911
Message ID:
00110290
Views:
37
>Bernard,
>
>David F, in his response to you on this same message, gives you the reason to use indexes. I believe that if you think about it a little you will see that even though it is "ad hoc", the fields which would be of interest would be a limited subset of the whole.
>
>Another thing *probably* slowing things down is the length of what you are selecting. * brings in your whole 520+ bytes record when, hopefully, the query really only needs a small subset of the fields. I believe that this can have a big impact, wspecially when you are selecting so many records.
>
>In summary, use INDEXes for "sensible" fields (including one on DELETED()), make sure your WHERE clause uses identical format as your index and limit the fields you select.
>That will give you the fastest possible query.

Another trick I have used when I had to run some queries on a cinemascope table (you get the picture, right?) was to omit all the memo fields and actually all the fields except the few keys from the query, like this:


use whatever order 0
select field1, field2, recno() as rcn from whatever ;
where [ad hoc query condition here];
into cursor narrow
set relation to rcn into whatever

I've actually included only those fields I needed for building indexes (because I wanted to do some seek()s on the resulting cursor), and pulled all the other fields (one record at a time) when I needed them. Since this was for visual presentation mostly, they never actually needed full details on more than one record at a time.

The machine I did this on was some poor 486/40 or so, and the effect of speeding it up was visible.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform