When processing a join
between a SAS data set and a DBMS table, the SAS data set should be
smaller than the DBMS table for optimal performance. However, if the
SAS data set is larger than the DBMS table, the SAS data set is still
used in the IN clause.
When SAS processes a
join between two DBMS tables, SELECT COUNT (*) is issued to determine
which table is smaller and if it qualifies for an IN clause. You can
use the DBMASTER= data set option to prevent the SELECT COUNT (*)
from being issued.
The IN clause currently
has a limit of 4,500 unique values.
Setting DBKEY= automatically
overrides MULTI_DATASRC_OPT=.
DIRECT_SQL= can impact
this option as well. If DIRECT_SQL=NONE or NOWHERE, the IN clause
cannot be built and passed to the DBMS, regardless of the value of
MULTI_DATASRC_OPT=. These settings for DIRECT_SQL= prevent a WHERE
clause from being passed.
Oracle: Oracle
can handle an IN clause of only 1,000 values. It therefore divides
larger IN clauses into multiple smaller IN clauses. The results are
combined into a single result set. For example, if an IN clause contained
4,000 values, Oracle produces 4 IN clauses, each of which contains
1,000 values. A single result is produced,
as if all
4,000 values were processed as a whole.
OLE
DB: OLE DB restricts the number of values allowed
in an IN clause to 255.