is there a difference in the Informix query performance using ANSI syntax:
SELECT ..
LEFT OUTER JOIN some_table ON (<condition>)
LEFT OUTER JOIN some_other_table (<condition_on_some_table>)
and Informix specific OUTER syntax:
SELECT ...
OUTER (some_table,
OUTER(some_other_table))
WHERE <join_conditions>
thanks
Yes, there are differences in the semantics of a Standard outer join and an Informix-style outer join which inevitably means that there are differences in the query plan.
In general, use the Standard notation for any new or modified code – leave the Informix-style outer join notation for (unchanged) legacy code, and preferably update even that to use the new join notations.
What is the difference? Fair question – hard to explain, and harder still to come up with a good (plausible example). Basically, the Informix-style notation preserves the rows from the ‘dominant’ tables (the non-outer tables) even when there are criteria based on the values in the outer-joined table that would reject those rows.
These two queries produce the same result:
These two queries do not necessarily produce the same result:
The difference occurs in a situation like this:
The standard LEFT OUTER JOIN notation will produce the empty set as the result. The Informix-style join will produce the result:
The data from DominantTable was not rejected because of a filter condition on the dominant table, so it is preserved by Informix. The standard join does the outer join and then filters the result.