To perform a threaded Read, SAS first creates threads
within the SAS session. Threads are standard operating system tasks
that SAS controls. SAS then establishes a DBMS connection on each
thread, causes the DBMS to partition the result set, and reads one
partition per thread. To cause the partitioning, SAS appends a WHERE
clause to the SQL so that a single SQL statement becomes multiple
SQL statements, one for each thread. Here is an example.
proc reg SIMPLE
data=dblib.salesdata (keep=salesnumber maxsales);
ar _ALL_;
run;
Previous versions of
SAS opened a single connection and issued:
SELECT salesnumber,maxsales FROM SALESDATA;
Assuming that SalesData
has an EmployeeNum integer column, SAS 9.1 might open two connections
by issuing these two statements:
SELECT salesnumber,maxsales FROM salesdata WHERE (EMPLOYEENUM mod 2)=0;
SELECT salesnumber,maxsales FROM SALESDATA WHERE (EMPLOYEENUM mod 2)=1;
Note: Might is
an important word here. Most but not all
SAS/ACCESS interfaces support
threaded Reads in SAS 9.1. The partitioning WHERE clauses that SAS
generates vary. In cases where SAS cannot always generate partitioning
WHERE clauses, the SAS user can supply them. In addition to WHERE
clauses, other ways to partition data might also exist.