I have a query:
SELECT COUNT(1)
FROM registration r,
proxy p
WHERE r.participant_code = p.participant_code
AND r.proxy_type = p.proxy_type
AND r.proxy_value = p.proxy_value
AND r.proxy_sequence= p.proxy_sequence
All four fields used in join conditions for table 'proxy' are in 'proxy' primary key. Execution plan of the query has been using primary key to make a scan, but since one moment it suddenly changed index scan on full table scan.
After that query was changed a little(joins 'r.proxy_value = p.proxy_value' and 'r.proxy_type = p.proxy_type' where swapped):
SELECT COUNT(1)
FROM registration r,
proxy p
WHERE r.participant_code = p.participant_code
AND r.proxy_value = p.proxy_value
AND r.proxy_type = p.proxy_type
AND r.proxy_sequence= p.proxy_sequence
Actually both queries are equivalent. However after this change execution plan of the second query starts using index scan instead of full scan.
Now I have a very specific question:
Will Oracle recompile the second query and will it lead to query execution plan changing?
WHEREclause. Though intuitively one may think they are the same, I would make them both identical and re-test (yes, I agree with you that this seams to be a very amateur-like comment, but I was surprised too many times in my life with this type of things). - FDavidovWHEREclause)? If yes, did you observe different execution plans for them? - FDavidov