SQL Procedure Pass-Through Facility: Teradata Specifics

by Irina 9. June 2007 13:31
You can use the pass-through facility of PROC SQL to build your own Teradata SQL statements and then pass them to the Teradata server for execution.

Example 1: Deleting and Recreating a Teradata Table:

proc sql;
connect to teradata
(user=abc password=aaa tdpid=DWPROD);
execute (drop table dwp_sas.ir_reshima_halvaot) by teradata;
execute (create table salary (current_salary float, name char(10))) 
            by teradata;
execute (insert into salary values (35335.00, 'Dan J.')) by teradata;
execute (commit) by teradata;
disconnect from teradata;
quit;
When your DBMS is Teradata, there is an option called FASTLOAD= which can be set to YES.
The DBA suggested weuse it, and it did make a difference in the load time.

Example 2.

data tera_sas.ir_list_loan(fastload=yes);
set population;
run;

Example 3.

The first couple of times that you collect "new" statistics on a table, the AMPs must read every row and take its demographics using a full table scan. However, after you have once collected various column and index statistics, all you need do is issue this command: COLLECT STATISTICS ON ;
It will then read all the rows one time and collect all the statistics. This will great improve performance over recollecting each statistic individually.
proc sql;
   connect to teradata
(user=abc password=aaa tdpid=DWPROD);
   execute (COLLECT STAT ON  dwp_sas.uhl_eutz_model COLUMN  branch_cust_ip) by teradata;  
   execute (commit) by teradata;
   disconnect from teradata;
quit;

Example 4.

FASTEXPORT
The FASTEXPORT utility must be licensed separately from NCR to be used by SAS 9. FASTEXPORT is invoked by using the DBSLICEPARM=ALL option. SAS 9 automatically generates the specialized script required for the FASTEXPORT utility and retrieves the data back from FASTEXPORT on sockets. FASTEXPORT is supported on explicit SQL as well.
libname tra Teradata user=terauser pw=XXXXXX server=boom;
proc freq data=tra.big(dbsliceparm=all);
table x1-x3;
run;
Following is an example using explicit SQL.
proc sql;
connect to teradata(user=terauser password=XXXXXX server=boom
dbsliceparm=all);
select * from connection to teradata
(select * from big);
quit;

About the author

Irina Spivak Irina Spivak
Team Leader at G-Stat. More...


Send mail Email

Authors

Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in

    eXTReMe Tracker