<?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 Re: SAS Data Integration Studio - Table Loader - Replace All Rows Using Truncate - Optimization... in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207099#M4714</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mrtball,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may be a good idea to make sure that the TRUNCATE statement is being passed to MS SQL. I am not entirely sure that TRUNCATE can be passed to MS SQL via a SAS option. You can put the statement into an explicit pass-through statement. If TRUNCATE isn't used a DELETE statement is used. This means it is logged by the database and will be slow. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the BULKLOAD= option set to "yes" on your LIBNAME statement? If it isn't, that is where I would start. Once you have that set start focusing on indexes. Loading tables with indexes defined on them can be an issue with MS SQL. You may want drop the indexes prior to running your load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jun 2015 19:09:00 GMT</pubDate>
    <dc:creator>JBailey</dc:creator>
    <dc:date>2015-06-17T19:09:00Z</dc:date>
    <item>
      <title>SAS Data Integration Studio - Table Loader - Replace All Rows Using Truncate - Optimization...</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207098#M4713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have in the past few months started to look at the optimisation and performance of our SAS DI Studio created processes.&amp;nbsp; Our source / destination data tables are SQL server OLEDB connections.&lt;/P&gt;&lt;P&gt;I'm currently looking at a Table Loader, that is loading 67,000,000 records via the Replace load Style &amp;gt; All Rows Using Truncate &amp;gt; Append (Proc Append) (Please see attached screen shot Load Technique.jpg)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This took 7 hours to complete on our test environment (which has about 50% less resources than production). &lt;/P&gt;&lt;P&gt;Even though 67,000,000 records is a large volume, I was expecting this to run quicker than 7 hours (maybe 3-4hours) - as some smaller tables (3-4 million records) complete within 10mins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The big observation I have about this is that the destination table contains 4 indexes and no keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wondering if anybody has any ideas whether they think the 7 hour runtime is to be expected? And if not is there any improvements we could make to the table loader / table /&amp;nbsp; library to improve performance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11411i97BFF93234F45BAB/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Load Technique.jpg" title="Load Technique.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 10:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207098#M4713</guid>
      <dc:creator>mrtball</dc:creator>
      <dc:date>2015-06-16T10:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Data Integration Studio - Table Loader - Replace All Rows Using Truncate - Optimization...</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207099#M4714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mrtball,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may be a good idea to make sure that the TRUNCATE statement is being passed to MS SQL. I am not entirely sure that TRUNCATE can be passed to MS SQL via a SAS option. You can put the statement into an explicit pass-through statement. If TRUNCATE isn't used a DELETE statement is used. This means it is logged by the database and will be slow. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the BULKLOAD= option set to "yes" on your LIBNAME statement? If it isn't, that is where I would start. Once you have that set start focusing on indexes. Loading tables with indexes defined on them can be an issue with MS SQL. You may want drop the indexes prior to running your load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 19:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207099#M4714</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2015-06-17T19:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Data Integration Studio - Table Loader - Replace All Rows Using Truncate - Optimization...</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207100#M4715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps you should try creating a flat file of your test file, and testing the loading of that file to SQL Server. This would give you a chance to i) get an idea how long SQL Server needs natively to do the load, and ii) experiment with dropping and recreating indexes, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have an optimized load scenario, you can work on producing the same scenario with SAS. As &lt;A __default_attr="817510" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; says, using BULKLOAD is probably critical. SAS transfers to DBMS tables without it tend to be excruciatingly slow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 21:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207100#M4715</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-06-17T21:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Data Integration Studio - Table Loader - Replace All Rows Using Truncate - Optimization...</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207101#M4716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;"Our source / destination data tables are SQL server OLEDB connections."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Does above statement mean both source and target table reside on SQL Server? If so and based on the elapsed times for your smaller 3-4M tables the very first thing I would be looking into is that processing happens fully within the data base and that you're not transferring data from the database to SAS and back.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Do you know below options?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ft" style="color: #545454; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;OPTIONS SASTRACE=',,,d' SASTRACELOC=SASLOG &lt;SPAN style="font-weight: bold; color: #6a6a6a;"&gt;NOSTSUFFIX&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ft" style="color: #545454; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ft" style="color: #545454; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;If you really need to pull data into SAS and then load it from there then using bulk load is certainly a good option. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ft" style="color: #545454; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ft" style="color: #545454; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;Without bulk load and using implicit SQL: There are a few libname options you might want to look into like "dbcommit" and "insertbuff" &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 21:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207101#M4716</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-06-17T21:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Data Integration Studio - Table Loader - Replace All Rows Using Truncate - Optimization...</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207102#M4717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your source and destination tables are in MS SQL, specifically the same MS SQL server, then your strategy will change. Pulling data out of the database then putting it back in should be avoided if at all possible. Take a look at the DBIDIRECTEXEC system option or the DIRECT_EXE= LIBNAME statement option. These options push CREATE TABLE AS and DELETE processing to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having source and destination tables in a database means that you have to optimize both sides of the process - a SQL query and a load (or insert). In your case, this means that you have a third thing to worry about - TRUNCATE. If SAS performs the DELETE it will be slow. It will pull data into SAS then issue the DELETE one row at a time. If you use DBIDIRECTEXEC the DELETE will be pushed to MS SQL. This is better, but the DELETE statements are still logged. The best way to do this is TRUNCATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The key here is to know what is actually happening in the database. The SASTRACE statement that &lt;A __default_attr="12296" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt; mentioned is a great way to see the SQL that SAS is passing to the database. I don't know how this works in DI Studio. You may be able to have your DBA monitor the database and tell you if TRUNCATE is being executed. If it isn't you may want to consider issuing the command via explicit pass-thru.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="379045" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt;'s suggestion is very good. Testing outside of SAS can help determine if your run times are acceptable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may find this paper useful. It doesn't specifically cover loading, but you may find it useful.&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings13/080-2013.pdf" title="https://support.sas.com/resources/papers/proceedings13/080-2013.pdf"&gt;https://support.sas.com/resources/papers/proceedings13/080-2013.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 13:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Data-Integration-Studio-Table-Loader-Replace-All-Rows-Using/m-p/207102#M4717</guid>
      <dc:creator>JBailey</dc:creator>
      <dc:date>2015-06-18T13:11:02Z</dc:date>
    </item>
  </channel>
</rss>

