Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible to optimize subquery??
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00237460
Message ID:
00237475
Views:
16
>>Hi,
>>
>>I have a table 'person' with 11000 records and a small temporary dbf 'localTest' with 9 records.
>>
>>The query below takes 10(!) seconds to perform and the resultset is 65 records. The SET DELETED setting does not change this time, nor if I have an index on UPPER(id) in 'localTest'. There is an index on UPPER(person.company_id).
>>
>>SELECT person.firstname ;
>> FROM person ;
>> WHERE UPPER(person.company_id) IN (SELECT UPPER(id) FROM localTest)
>>
>>Does anyone know how this query can be optimized so that it uses Rushmore, or is this not possible??
>>
>>
>>Klas Nygren
>Klas,
>
>Is it quicker to join the files?
>
>SELECT Person.FirstName FROM Person, LocalTest WHERE Person.Company_id = LocalTest.Id

Ian,

It is much faster to join the tables. However, the subquery I am trying to speed up is part of a larger query in which it is not possible to replace the subquery with a join.

Klas
(using VFP 3.0 for Win & Mac)
Previous
Reply
Map
View

Click here to load this message in the networking platform