Unlike other Teradata LIBNAME options,
you can also invoke PreFetch globally for a SAS job. To do this, place
the OPTION DEBUG= statement in your SAS program before all LIBNAME
statements and PROC SQL steps. If your job contains multiple LIBNAME
statements, the global PreFetch invocation creates a uniquely named
SQL cache name for each of the librefs.
Do not be confused by
the DEBUG= option here. It is merely a mechanism to deliver the PreFetch
capability globally. PreFetch is not for debugging; it is a supported
feature of
SAS/ACCESS Interface to Teradata.
In this example the
first time you run the job with PreFetch enabled, the facility creates
three Teradata macros: UNIQUE_MAC1, UNIQUE_MAC2, and UNIQUE_MAC3.
In subsequent runs of the job, PreFetch extracts SQL statements
from these Teradata macros, enhancing the job performance across all
three librefs referenced by the job.
option debug="PREFETCH(unique_mac,2,SEQUENTIAL)";
libname one teradata user=kamdar password=ellis;
libname two teradata user=kamdar password=ellis
database=larry;
libname three teradata user=kamdar password=ellis
database=wayne;
proc print data=one.kamdar_goods;
run;
proc print data=two.larry_services;
run;
proc print data=three.wayne_miscellaneous;
run;
In this example PreFetch
selects the algorithm, that is, the order of the SQL statements. (The
OPTION DEBUG= statement must be the first statement in your SAS job.)
option debug='prefetch(pf_unique_sas,3)';
In this example the
user specifies for PreFetch to use the SEQUENTIAL algorithm. (The
OPTION DEBUG= statement must be the first statement in your SAS job.)
option debug='prefetch(sas_pf_store,3,sequential)';