13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Threaded Reads 4 Autopartitioning Techniques in <strong>SAS</strong>/<strong>ACCESS</strong> 57Per<strong>for</strong>mance Impact of Threaded ReadsThreaded reads only increase per<strong>for</strong>mance when the DBMS result set is large.Per<strong>for</strong>mance is optimal when the partitions are similar in size. Using threaded readsshould reduce the elapsed time of your <strong>SAS</strong> step, but unusual cases can slow the <strong>SAS</strong>step. They generally increase the workload on your DBMS.For example, threaded reads <strong>for</strong> DB2 under z/OS involve a tradeoff, generallyreducing job elapsed time but increasing DB2 workload and CPU usage. See the autopartitioning documentation <strong>for</strong> DB2 under z/OS <strong>for</strong> details.<strong>SAS</strong> automatically tries to autopartition table references <strong>for</strong> <strong>SAS</strong> in threadedapplications. To determine whether autopartitioning is occurring and to assess itsper<strong>for</strong>mance, complete these tasks:3 Turn on <strong>SAS</strong> tracing to see whether <strong>SAS</strong> is autopartitioning and to view the SQLassociated with each thread.3 Know your DBMS algorithm <strong>for</strong> autopartitioning.3 Turn threaded reads on and off, and compare the elapsed times.Follow these guidelines to ensure optimal tuning of threaded reads.3 Use it only when pulling large result sets into <strong>SAS</strong> from the DBMS.3 Use DBSLICE= to partition if <strong>SAS</strong> autopartitioning does not occur.3 Override autopartitioning with DBSLICE= if you can manually providesubstantially better partitioning. The best partitioning equally distributes theresult set across the threads.3 See the DBMS-specific reference section in this document <strong>for</strong> in<strong>for</strong>mation and tips<strong>for</strong> your DBMS.Threaded reads are most effective on new, faster computer hardware running <strong>SAS</strong>,and with a powerful parallel edition of the DBMS. For example, if <strong>SAS</strong> runs on a fastuniprocessor or on a multiprocessor machine and your DBMS runs on a high-end SMPserver, you can experience substantial per<strong>for</strong>mance gains. However, you can experienceminimal gains or even per<strong>for</strong>mance degradation when running <strong>SAS</strong> on an old desktopmodel with a nonparallel DBMS edition running on old hardware.Autopartitioning Techniques in <strong>SAS</strong>/<strong>ACCESS</strong><strong>SAS</strong>/<strong>ACCESS</strong> products share an autopartitioning scheme based on the MODfunction. Some products support additional techniques. For example, if your Oracletables are physically partitioned in the DBMS, <strong>SAS</strong>/<strong>ACCESS</strong> Interface to Oracleautomatically partitions in accordance with Oracle physical partitions rather thanusing MOD. <strong>SAS</strong>/<strong>ACCESS</strong> Interface to Teradata uses FastExport, if available, whichlets the FastExport Utility direct partitioning.MOD is a mathematical function that produces the remainder of a division operation.Your DBMS table must contain a column to which <strong>SAS</strong> can apply the MOD function —a numeric column constrained to integral values. DBMS integer and small integercolumns suit this purpose. Integral decimal (numeric) type columns can work as well.On each thread, <strong>SAS</strong> appends a WHERE clause to your SQL that uses the MODfunction with the numeric column to create a subset of the result set. Combined, thesesubsets add up to exactly the result set <strong>for</strong> your original single SQL statement.For example, assume that your original SQL that <strong>SAS</strong> produced is SELECT CHR1,CHR2 FROM DBTAB and that table Dbtab contains integer column IntCol. <strong>SAS</strong> createstwo threads and issues:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!