41
CHAPTER
6
Threaded Reads
Overview of Threaded Reads in SAS/ACCESS
41
Underlying Technology of Threaded Reads
41
SAS/ACCESS Interfaces and Threaded Reads
42
Scope of Threaded Reads
42
Options That Affect Threaded Reads
43
Generating Trace Information for Threaded Reads 44
Performance Impact of Threaded Reads
45
Autopartitioning Techniques in SAS/ACCESS
46
Data Ordering in SAS/ACCESS
47
Two Pass Processing for SAS Threaded Applications
47
Summary of Threaded Reads
47
Overview of Threaded Reads in SAS/ACCESS
In Version 8 and earlier, SAS opened a single connection to the DBMS to read a
table. SAS statements requesting data were converted to an SQL statement and passed
to the DBMS. The DBMS processed the SQL statement, produced a result set consisting
of table rows and columns, and transferred the result set back to SAS on the single
connection.
With a threaded read, the table read time can be reduced by retrieving the result set
on multiple connections between SAS and the DBMS. SAS is able to create multiple
threads, and a read connection is established between the DBMS and each SAS thread.
The result set is partitioned across the connections, and rows are passed to SAS
simultaneously (in parallel) across the connections, improving performance.
Underlying Technology of Threaded Reads
To perform a threaded read, SAS first creates threads, which are standard operating
system tasks controlled by SAS, within the SAS session. Next, SAS establishes a
DBMS connection on each thread. SAS then 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. For example:
proc reg SIMPLE
data=dblib.salesdata (keep=salesnumber maxsales);
var _
ALL_;
run;