Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not optimized
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01449210
Message ID:
01449229
Views:
55
>>The following is very slow, presumably because of my use of IN
Select * From KTrackTagDetail							;
>>	where (Seqno In (Select Seqno From C_Kits)			;
>>	or SeqnoFG In (Select Seqno From C_Kits))			;
>>	and Left (RecordType,2) # 'AP'						;
>>	into Cursor C_Detail
>>So, how can I speed this up?
>>
>>Thanks
>
>Jim,
>
>Alternative solution would be to use EXISTS. Also, do you have an index on LEFT(RecordType,2) -- if not, use NOT LIKE instead.
>
>select ...
>from myTable T where exists (select 1 from c_Kits K where K.SeqNo = T.SeqNo) and NOT RecordType LIKE 'AP%'
>UNION
>select ...from myTable T where exists (select 1 from c_Kits K where K.SeqNo = T.SeqNoFG) and NOT RecordType LIKE 'AP%'
One more thing - assuming you have an index on both SeqNo and SeqNoFG and LEFT(RecordType,2) then add NOFILTER to your select statement.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform