<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic odbc execution time issues with sql server and SAS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/odbc-execution-time-issues-with-sql-server-and-SAS/m-p/429994#M68577</link>
    <description>&lt;P&gt;i've written an sql query that has a run time of about 14 seconds when i run it on ms management studio, but as soon as i try to run the query via explicit sql pass-through in SAS EG or DI using ODBC the run time exceeds 20 (!!!) hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've boiled down the issue to the buffer size option in the connection string, when the buffer size is set to zero, the execution time is about 14 to 17 seconds. on examination of the sas trace log i've noticed that when the buffer size is set to any number other then 0 the fetch phase of the odbc engine consumes about 99% of the long process time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm inclined to leave the buffer at zero but i have a feeling the my SQL server DBA will be more then upset with that, as the sql server is writing one row at a time to SAS. unfortunetly OLE DB is not an option so i cant compare methods. any one has any idea about whats going on?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS SASTRACE='D,,T,SA' SASTRACELOC = SASLOG NOSTSUFFIX; 
PROC SQL;&lt;BR /&gt;CONNECT TO ODBC (DEFER=YES READBUFF=0 INSERT_SQL=YES INSERTBUFF=32000 UPDATE_MULT_ROWS=YES AUTOCOMMIT=YES DATAsrc=AML AUTHDOMAIN="FCAMLFAPP Core"); 
   CREATE TABLE work.REL_ACC AS 
                  SELECT * FROM CONNECTION TO ODBC 
                        ( 
        SELECT 
      LTRIM(RTRIM(ALL_EMPS.employee_number)) AS employee_number, 
          BRDG.account_number, 
      'ASSOC_ACC' as ACC_TYPE, 
      ACC.x_account_primary_branch_nbr as BRANCH_NUM_INT 
   from 
      FCALM_STG.ALL_EMPS as ALL_EMPS 
                INNER JOIN FCALMCAPP.FSC_PARTY_ASSOC as ASSOC on ALL_EMPS.party_number = ASSOC.party_number AND ASSOC.change_current_ind = 'Y' 
                INNER JOIN FCALMCAPP.X_FSC_PARTY_ACCOUNT_BRIDGE_BNHP as BRDG on ASSOC.related_party_number = BRDG.party_number AND BRDG.change_current_ind = 'Y' 
                INNER JOIN FCALMCAPP.FSC_ACCOUNT_DIM as ACC on BRDG.account_number = ACC.account_number AND ACC.change_current_ind = 'Y' 
   where 
      ACC.account_status_desc = 'פעיל' AND 
                ACC.x_account_primary_branch_nbr NOT IN (556,775) AND 
      BRDG.role_key IN (1,2) 
              ); 
DISCONNECT FROM ODBC; 
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Jan 2018 18:27:44 GMT</pubDate>
    <dc:creator>erez3231</dc:creator>
    <dc:date>2018-01-23T18:27:44Z</dc:date>
    <item>
      <title>odbc execution time issues with sql server and SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/odbc-execution-time-issues-with-sql-server-and-SAS/m-p/429994#M68577</link>
      <description>&lt;P&gt;i've written an sql query that has a run time of about 14 seconds when i run it on ms management studio, but as soon as i try to run the query via explicit sql pass-through in SAS EG or DI using ODBC the run time exceeds 20 (!!!) hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've boiled down the issue to the buffer size option in the connection string, when the buffer size is set to zero, the execution time is about 14 to 17 seconds. on examination of the sas trace log i've noticed that when the buffer size is set to any number other then 0 the fetch phase of the odbc engine consumes about 99% of the long process time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm inclined to leave the buffer at zero but i have a feeling the my SQL server DBA will be more then upset with that, as the sql server is writing one row at a time to SAS. unfortunetly OLE DB is not an option so i cant compare methods. any one has any idea about whats going on?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS SASTRACE='D,,T,SA' SASTRACELOC = SASLOG NOSTSUFFIX; 
PROC SQL;&lt;BR /&gt;CONNECT TO ODBC (DEFER=YES READBUFF=0 INSERT_SQL=YES INSERTBUFF=32000 UPDATE_MULT_ROWS=YES AUTOCOMMIT=YES DATAsrc=AML AUTHDOMAIN="FCAMLFAPP Core"); 
   CREATE TABLE work.REL_ACC AS 
                  SELECT * FROM CONNECTION TO ODBC 
                        ( 
        SELECT 
      LTRIM(RTRIM(ALL_EMPS.employee_number)) AS employee_number, 
          BRDG.account_number, 
      'ASSOC_ACC' as ACC_TYPE, 
      ACC.x_account_primary_branch_nbr as BRANCH_NUM_INT 
   from 
      FCALM_STG.ALL_EMPS as ALL_EMPS 
                INNER JOIN FCALMCAPP.FSC_PARTY_ASSOC as ASSOC on ALL_EMPS.party_number = ASSOC.party_number AND ASSOC.change_current_ind = 'Y' 
                INNER JOIN FCALMCAPP.X_FSC_PARTY_ACCOUNT_BRIDGE_BNHP as BRDG on ASSOC.related_party_number = BRDG.party_number AND BRDG.change_current_ind = 'Y' 
                INNER JOIN FCALMCAPP.FSC_ACCOUNT_DIM as ACC on BRDG.account_number = ACC.account_number AND ACC.change_current_ind = 'Y' 
   where 
      ACC.account_status_desc = 'פעיל' AND 
                ACC.x_account_primary_branch_nbr NOT IN (556,775) AND 
      BRDG.role_key IN (1,2) 
              ); 
DISCONNECT FROM ODBC; 
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/odbc-execution-time-issues-with-sql-server-and-SAS/m-p/429994#M68577</guid>
      <dc:creator>erez3231</dc:creator>
      <dc:date>2018-01-23T18:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: odbc execution time issues with sql server and SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/odbc-execution-time-issues-with-sql-server-and-SAS/m-p/430112#M68587</link>
      <description>&lt;P&gt;&amp;nbsp;As far as I know there is no bulk load utility that move lot of rows from SQL server to SAS.&lt;/P&gt;
&lt;P&gt;Try this, I am not sure whether it will work, create a permanent table in SQL server table(if you have rights to create) for your joins and then move that table to SAS in next step.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/odbc-execution-time-issues-with-sql-server-and-SAS/m-p/430112#M68587</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-01-23T18:37:24Z</dc:date>
    </item>
  </channel>
</rss>

