Hi!
WHERE applied after the applying join conditions. In the first query join condition select much less records than in the second query, then apply WHERE condition. Thus I guess second query works lsower because more memory required to store intermediate results or something like that.
>Hi,
>I want to ask something about rushmore in VFP6.0
>I tried 2 methods to join 2 tables
>1. select A.*,B.* from A inner join B on A.key1=B.key1 and A.key2=B.key2 where A.key1=constantA
>2. select A.*,B.* from A inner join B on A.key2=B.key2 where A.key1=ConstantA and B.key1=ConstantA
>and found the time taken was different! SQL 2 was much faster than SQL 1.
>All fields included in the condition was indexed. I used sys(3054) to check, and found that SQL 2 used temp index and SQL1 used key2 as index. Could anybody tell me why?
>TIA.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.