<?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 Proc SQL Delete Very Slow in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172195#M44409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table1 - 10,000,000 rows&lt;/P&gt;&lt;P&gt;Key: cd1, cd2, cd3, cd4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table2 - 30,000 rows&lt;/P&gt;&lt;P&gt;Key: cd1, cd2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I want to run the sql below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; delete&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; from table1 a &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; where exists (select 1 from table2 b where a.cd1=b.cd1 and a.cd2=b.cd2)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sql took more than three hours and did not finish.&lt;/P&gt;&lt;P&gt;table1 and table2 are SAS tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Does anyone have any tips on how to optimize this SQL?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Nov 2014 17:02:42 GMT</pubDate>
    <dc:creator>DavidCaliman</dc:creator>
    <dc:date>2014-11-14T17:02:42Z</dc:date>
    <item>
      <title>Proc SQL Delete Very Slow</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172195#M44409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table1 - 10,000,000 rows&lt;/P&gt;&lt;P&gt;Key: cd1, cd2, cd3, cd4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table2 - 30,000 rows&lt;/P&gt;&lt;P&gt;Key: cd1, cd2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I want to run the sql below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; delete&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; from table1 a &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; where exists (select 1 from table2 b where a.cd1=b.cd1 and a.cd2=b.cd2)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sql took more than three hours and did not finish.&lt;/P&gt;&lt;P&gt;table1 and table2 are SAS tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Does anyone have any tips on how to optimize this SQL?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 17:02:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172195#M44409</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2014-11-14T17:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Delete Very Slow</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172196#M44410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;optimizing.... then do not uses SQL.&amp;nbsp; &lt;/P&gt;&lt;P&gt;SQL is designed to have the machine decide. When that decisions are not as wanted the human brain should do his work.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 18:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172196#M44410</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-11-14T18:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Delete Very Slow</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172197#M44411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to use data step ,when the table is very very big. For you scenario, I recommend Hash Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Nov 2014 08:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Delete-Very-Slow/m-p/172197#M44411</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-15T08:58:12Z</dc:date>
    </item>
  </channel>
</rss>

