Relational Databases & SAS – Understanding Architecture & Performance Bill Gibson CTO, SAS ANZ
Agenda <ul><li>SAS/Access Architecture Overview </li></ul><ul><li>Diagnosing Performance </li></ul><ul><li>Stopping Bad Pe...
SAS/Access <ul><li>SAS/Access is a family of “adaptors” for SAS to access databases </li></ul>Server Session RDBMS RDBMS R...
SAS/Access Categories <ul><li>Relational Databases </li></ul><ul><ul><li>Native – 1 per database </li></ul></ul><ul><ul><l...
SAS/Access for Relational DBs - Features <ul><li>SAS Table emulation  </li></ul><ul><li>SQL Interface  </li></ul><ul><ul><...
SAS/Access & SAS 9 Tools <ul><li>Enterprise Guide </li></ul><ul><li>DI Studio </li></ul><ul><li>Web Report Studio / Inform...
Basics
Reading Data <ul><li>Treating DB table as SAS data set </li></ul><ul><ul><li>PROC PRINT data=dbms_table </li></ul></ul><ul...
Diagnosing Performance <ul><li>Understand where processing is happening </li></ul><ul><ul><li>Where clause processing </li...
Understanding what DBMS SQL SAS Generates <ul><li>Options sastrace=',,,d' no$stsuffix sastraceloc=saslog; </li></ul>PROC S...
SAS Options to improve performance <ul><li>READBUFF, INSERTBUFF, UPDATEBUFF </li></ul><ul><li>DBMASTER </li></ul><ul><li>D...
READBUFF Example libname  oradata oracle  user = sh  pw = sh1  path = demodb.na.sas.com  READBUFF =10000;
Demo
 
Writing & Updating <ul><li>Loading tables </li></ul><ul><ul><li>- See DI Studio for best Practices!! </li></ul></ul><ul><u...
Bulk Loaders <ul><li>DB2  IMPORT, LOAD, and CLI LOAD.  </li></ul><ul><li>Oracle SQL*Loader  </li></ul><ul><ul><li>The fast...
Updating DBMS Data <ul><li>SQL Inserts etc </li></ul><ul><ul><li>PROC SQL </li></ul></ul><ul><ul><li>(Fast)Load update dat...
SAS/Access Recommendations <ul><li>Don’t be satisfied with long run times, until you know it can’t be better </li></ul><ul...
Future Plans <ul><li>SAS® In-Database Processing </li></ul><ul><li>A Roadmap for Deeper Technical Integration with Databas...
Questions?
Upcoming SlideShare
Loading in...5
×

Relational Databases

516

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
516
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Relational Databases &amp; SAS – Understanding Architecture &amp; Performance When data is split between a relational databases and SAS, it can be critical to make sure that the processing is managed to happen where its most appropriate - in SAS or the database.  Not understanding the architecture, can lead to an application taking hours to run, when it could run in minutes.    This presentation will overview the architecture of SAS /Access, and explore how to make it work most effectively.  This applies to databases such as Oracle, DB2, SQL Server and Teradata, as well as those accessed via ODBC.  I’ll try to make sure this presentation has something in it for both new and experienced SAS/Access users, and will provide a very useful set of additional resources.
  • Relational Databases

    1. 1. Relational Databases & SAS – Understanding Architecture & Performance Bill Gibson CTO, SAS ANZ
    2. 2. Agenda <ul><li>SAS/Access Architecture Overview </li></ul><ul><li>Diagnosing Performance </li></ul><ul><li>Stopping Bad Performance </li></ul><ul><li>N-Tier Issues </li></ul><ul><li>References </li></ul>
    3. 3. SAS/Access <ul><li>SAS/Access is a family of “adaptors” for SAS to access databases </li></ul>Server Session RDBMS RDBMS RDBMS Middleware SAS Session - SAS/Access to RDBMS DBMS Client
    4. 4. SAS/Access Categories <ul><li>Relational Databases </li></ul><ul><ul><li>Native – 1 per database </li></ul></ul><ul><ul><li>ODBC/OLE DB </li></ul></ul><ul><li>Legacy Mainframe DataBases </li></ul><ul><li>SAS/Access to PC File Formats </li></ul><ul><ul><li>Hybrid </li></ul></ul><ul><ul><li>Unix specific extensions </li></ul></ul><ul><li>Also adaptors for ERP systems </li></ul>
    5. 5. SAS/Access for Relational DBs - Features <ul><li>SAS Table emulation </li></ul><ul><li>SQL Interface </li></ul><ul><ul><li>Implicit SQL generated </li></ul></ul><ul><ul><li>Explicit SQL “Passthrough” </li></ul></ul><ul><li>4GL Data step “interfaces” (Keyed access using Indexes) </li></ul><ul><li>Bulkload Interfaces for high volume DW loading </li></ul><ul><ul><ul><li>Not all DBMSs </li></ul></ul></ul>
    6. 6. SAS/Access & SAS 9 Tools <ul><li>Enterprise Guide </li></ul><ul><li>DI Studio </li></ul><ul><li>Web Report Studio / Information Map Studio </li></ul><ul><li>No magic – all effectively act as code generators </li></ul><ul><li>When tuning these tools, you may need to look at underlying code generated. </li></ul>
    7. 7. Basics
    8. 8. Reading Data <ul><li>Treating DB table as SAS data set </li></ul><ul><ul><li>PROC PRINT data=dbms_table </li></ul></ul><ul><li>SAS SQL </li></ul><ul><li>Passthrough </li></ul><ul><li>Joins </li></ul><ul><li>Heterogeneous Joins </li></ul><ul><li>Parallel Reads </li></ul>
    9. 9. Diagnosing Performance <ul><li>Understand where processing is happening </li></ul><ul><ul><li>Where clause processing </li></ul></ul><ul><ul><li>Joins </li></ul></ul><ul><ul><li>Ordering </li></ul></ul><ul><li>No real difference to SAS Basics </li></ul><ul><ul><li>Drop/Keep </li></ul></ul><ul><ul><li>WHERE not IF </li></ul></ul>
    10. 10. Understanding what DBMS SQL SAS Generates <ul><li>Options sastrace=',,,d' no$stsuffix sastraceloc=saslog; </li></ul>PROC SQL; CREATE TABLE WORK.Query2_for_CENSUS AS SELECT CENSUS.GENDER FORMAT=$1., CENSUS.AGEDAYS, CENSUS.POSTCODE, CENSUS.INCOME, CENSUS.CHILDREN, CENSUS.AGE, CENSUS.DOB FORMAT=DATETIME20., CENSUS.MONTHB, CENSUS.YEARB FROM ORA_BILL.CENSUS AS CENSUS WHERE CENSUS.DOB >= '1jan1987:00:00:00'dt; ORACLE_15: Prepared: SELECT * FROM bill.CENSUS ORACLE_16: Prepared: SELECT &quot;GENDER&quot;, &quot;AGEDAYS&quot;, &quot;POSTCODE&quot;, &quot;INCOME&quot;, &quot;CHILDREN&quot;, &quot;AGE&quot;, &quot;DOB&quot;, &quot;MONTHB&quot;, &quot;YEARB&quot; FROM bill.CENSUS WHERE (&quot;DOB&quot; >=TO_TIMESTAMP(' 01JAN1987:00:00:00','DDMONYYYY:HH24:MI:SS.FF','NLS_DATE_LANGUAGE=American') ) ORACLE_17: Executed: SELECT statement ORACLE_16
    11. 11. SAS Options to improve performance <ul><li>READBUFF, INSERTBUFF, UPDATEBUFF </li></ul><ul><li>DBMASTER </li></ul><ul><li>DBKEY </li></ul><ul><li>Bulkloading </li></ul><ul><li>DBSLICEPARM for reading partitioned tables in parallel </li></ul>
    12. 12. READBUFF Example libname oradata oracle user = sh pw = sh1 path = demodb.na.sas.com READBUFF =10000;
    13. 13. Demo
    14. 15. Writing & Updating <ul><li>Loading tables </li></ul><ul><ul><li>- See DI Studio for best Practices!! </li></ul></ul><ul><ul><ul><li>Drop indexes </li></ul></ul></ul><ul><ul><ul><li>Truncate table </li></ul></ul></ul><ul><ul><ul><li>Load </li></ul></ul></ul><ul><ul><ul><li>Rebuild Indexes </li></ul></ul></ul><ul><ul><li>Data Step </li></ul></ul><ul><ul><li>Proc Append </li></ul></ul><ul><ul><li>Bulk Loads </li></ul></ul><ul><ul><ul><li>DBMS Specific </li></ul></ul></ul><ul><ul><ul><li>OLEDB/ODBC can only do bulk loads for SQL Server </li></ul></ul></ul>
    15. 16. Bulk Loaders <ul><li>DB2 IMPORT, LOAD, and CLI LOAD. </li></ul><ul><li>Oracle SQL*Loader </li></ul><ul><ul><li>The fastest method to load into Oracle. </li></ul></ul><ul><ul><li>Two load paths </li></ul></ul><ul><ul><ul><li>Conventional Path (Insert) = Slow </li></ul></ul></ul><ul><ul><ul><li>Direct Path = Fast </li></ul></ul></ul><ul><li>SQL Server BCP </li></ul><ul><li>All have their own idiosyncrasies </li></ul>
    16. 17. Updating DBMS Data <ul><li>SQL Inserts etc </li></ul><ul><ul><li>PROC SQL </li></ul></ul><ul><ul><li>(Fast)Load update data into DBMS then Passthrough insert, or upsert </li></ul></ul><ul><li>Data Step with Modify/ By </li></ul><ul><ul><li>Generates keyed reads. </li></ul></ul><ul><ul><li>View generated code with SASTRACE </li></ul></ul><ul><ul><li>Relatively slow </li></ul></ul>
    17. 18. SAS/Access Recommendations <ul><li>Don’t be satisfied with long run times, until you know it can’t be better </li></ul><ul><li>Understand the underlying processing, and where it is happening (SASTRACE) </li></ul><ul><li>Know the advanced SAS/Access options to help SAS process efficiently. </li></ul><ul><li>Be careful in building Information Maps with unnecessary formats </li></ul><ul><li>Make friends with your DBAs </li></ul>SAS/Access Resources http://support.sas.com/resources/papers/tnote/tnote_database.html .
    18. 19. Future Plans <ul><li>SAS® In-Database Processing </li></ul><ul><li>A Roadmap for Deeper Technical Integration with Database Management Systems http://support.sas.com/resources/papers/InDatabase07.pdf </li></ul>
    19. 20. Questions?
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×