Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help Optimizing a query
Message
From
09/08/2001 20:35:59
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00542086
Message ID:
00542092
Views:
24
That's true. Please see my reply to Alex Wieder.

>Dan,
>
>You don't need
        Not Empty( Ramp ) And ;
>        <b>Not</b> Empty( HourCount ) ;
because it's covered by
        Upper( Ramp ) = 'CHICAGO' And ;
>        Between( HourCount, 37, 48 ) And ;
Also expression Empty(Somefield) isn't rushmore optimizable. Use Somefield = Space(nn) instead.
>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform