Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to optimize this simple 'inner join'?
Message
 
 
To
29/09/2000 00:07:20
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00422415
Message ID:
00422480
Views:
9
Optimization, as far as VFP is concerned, refers to returning subsets of data and how efficiently it can be done.

The query you posted doesn't return a subset. It returns all records from the Master table and all records from Detail and then it matches them to return a final result set. There is no optimzation when all records are returned.

Bottom line is, if there is no WHERE clause to define a subset of data, there is no optimzation level returned from VFP. Having the indexes speeds up the processing because the records are matched using the index but it doesn't speed up the initial retrieval.

>Hi everyone.
>
>I have two tables this way:
>
>Master : Primary key = Field1 + Field2
>
>Detail : Regular index = Field1 + Field2 (Just like Master-Primary key)
>
>I am trying to see how VFP get optimized queries and found this:
>
>Select * from detail where field1+field2 = master.field1 + master.field2.
>
>It is optimized (sys(3054,1)) and works very fast, but of course, it only takes one record from master table.
>
>Now, I want all records using 'inner join' and similar expressions:
>
>Select * from master inner join detail on ;
> master.field1 + master.field2 = detail.field1 + detail.field2
>
>Optimization: None.
>Why this statement is not optimized?
>
>Thanks.
>
>Juan Carlos
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform