Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6.0 Optimize SQL
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00352764
Message ID:
00352794
Views:
10
Hi Bruce,
>>
>>I'd like to speed up my sql select statement and have tried everything I could think of to make it "Rushmore" optimized, to no avail.
>>
>>Here are two sql's, the first is slow, the second is fast.
>>
>>
>>***5,323 records in 40.03 secs.
>>select dam1, yr_bred, name, sex, sire1, booked_to, last_bred, p_b, date_foal, date_died, cause_deat, ;
>>price_sold, buy_name, age_rec, life_earn, cl from master where category = "F" and type = "S" or ;
>>type = "W" or type = "Y" order by dam1 into table foals nofilter

Use optimizable function INLIST instead of or condition, if number of types <=24 (Inlist is limited by 24 codes).
Is there an index on TYPE?


>>
>>***378 records in 4.31 secs.
>>select name, yr_foaled, booked_to, yr_bred, age_rec, life_earn, sire1, dam1, sire2, date_acqui, purch_pric, bought_fro, hands, descript from master where category = "F" and type = "B" and ;
>>date_died = {} and date_sold = {} and yr_bred = 2000 order by name into table mare nofilter
>>
>>The number of records returned doesn't seem to be a factor because I can revise the sql's to change the results set's numbers and the time to run remains about the same.
>>
>>I know there's something wrong with the slow sql, but I need help figuring it out.
>
>All the Booleans (and, or) can slow it down considerably. One solution is to break it up into 2 (or more) SELECTs into cursors along the way.


About Booleans: use explicit logical field =.t. or logical field = .f. in your SQL to make it Rushmore optimizable, if you have an Index on this logical field.

There is a chapter in Help devoted Rushmore optimizable functions. Very interesting reading, I can say :)

HTH
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform