Threaded Reads |
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);
var _ALL_; run;
Previous versions of SAS opened a single connection and issued:
SELECT salesnumber,maxsales FROM SALESDATA;
Assuming that SalesData has an integer column EmployeeNum, SAS 9.1, might open two connections by issuing these statements:
SELECT salesnumber,maxsales FROM salesdata WHERE (EMPLOYEENUM mod 2)=0;
and
SELECT salesnumber,maxsales FROM SALESDATA WHERE (EMPLOYEENUM mod 2)=1;
See Autopartitioning Techniques in SAS/ACCESS for more information about MOD.
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.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.