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.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao