asked on
ASKER
Sybase, a subsidiary of SAP, builds a client/server relational database management system. Products include Adaptive Server Enterprise (ASE), Adaptive Server Anywhere (ASA), Sybase Unwired Platform (SUP) for mobile applications, Afaria for enterprise mobile device management and IQ for data warehouse and big data applications.
TRUSTED BY
Subqueries don't give the optimiser any choice about what order to process the tables in - the subqueries have to be done first. But rewriting as a join means the optimiser can now consider picking each table as the "outer" table for the join... and "the other way around" might end up being much much faster than doing it as a subquery.
For example:
select A.name
from A
where A.id in (select B.id from B)
As written, the optimiser must run the subquery on table B first before it can start looking at table A... but there is nothing here preventing this from being rewritten as a join:
select A.name
from A, B
where A.id = B.id
Both queries return the same results, but the join gives the optimiser more options in terms of how to run it.
Re. join algorithms - they are written up in the IQ manuals, and I don't know of anywhere that describes them better than that. Since under normal circumstances this is not something you have any control over (the optimiser decides for you) I think Sybase haven't bothered trying to explain them in great detail.