Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help Optimizing a query
Message
 
 
À
10/08/2001 12:47:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00542086
Message ID:
00542382
Vues:
17
Try with SET DELETED OFF to test the speed difference.

Also what are the SET ANSI setting? Try to use the whole length expression on the right side, e.g., if Ramp (what is it, BTW?) is 20 chars, you should use variable lcRamp=padr('CHICAGO',20), etc.

You can try to drop index keys and run it again. Also show us, what SYS(3054,11) returned.

>Agreed, Nadya. Please read the rest of the thread. I am interested in your input.
>
>>>I have six conditions in my where clause.
>>>Upper( Ramp ) returns 27,705
>>>Between( HourCount, 37, 48 ) returns 147,711
>>>Upper( Vendor ) returns 555,784
>>>Not Empty( Ramp ) returns 957,731
>>>Not Empty( HourCount ) returns 957,731
>>>
>>>The table has 1,166,384 records.
>>>I have an index on Upper( Vendor )
>>>I have an index on Upper( Ramp )
>>>I have an index on HourCount.
>>>
>>>I do not have an index on Empty( Ramp )
>>>I do not have an index on Empty( HourCount )
>>>
>>>I am using variables but the with the above example the SQL looks like:
>>>
>>>Select ;
>>>        Ramp, ;
>>>        Vendor, ;
>>>        VendCity, ;
>>>        VendSt, ;
>>>        HourCount ;
>>>    Where ;
>>>        Upper( Ramp ) = 'CHICAGO' And ;
>>>        Between( HourCount, 37, 48 ) And ;
>>>        Upper( Vendor ) = 'NIKE' And ;
>>>        Not Empty( Ramp ) And ;
>>>        Empty( HourCount ) ;
>>>    Into Cursor qVendorTimes NoFilter
>>>
>>>
>>>I'm afraid to break the SQL down into multiple SQL's because writing out 27,000 records is going to be slow.
>>>
>>>Please help me.
>>>
>>>TIA
>>Obviously you don't need two last conditions. BTW, the last one contradicts with the second. If you want empty HourCount and HourCount between 37, 48 you should use OR condition, e.g.:
>>
(HourCount=0 or between(HourCount,37,48)
>>
>>Note, that empty is not Rushmore optimized function, so instead of empty you can use upper(Vendor)=space(30), where 30 is length of the Vendor field
>>
>>I wrote my reply before reading the whole thread, so I see now, that Alex and Sergey covered that already...
>>
>>A fresh look can just reveal the obvious problems...
>>
>>BTW, couple of times when I posted something in UT, I noticed problems, which I didn't notice before...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform