<?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: Compare sql with sql pass through in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512302#M137946</link>
    <description>&lt;P&gt;Check the definition of the libref SCHEMA.&amp;nbsp; Perhaps you are using different options than you did in your CONNECT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of performance of extracts it is usually the speed of the transfer from the remote database to the SAS server that is most important.&amp;nbsp; So perhaps you have options on your LIBNAME statement that enable SAS to use some bullk or fast transfer procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another issue is that there might be some caching going on in your database. So if you want the explicit query first and then implicit query pulled the same data again the database might respond quicker since the data was already in its cache.&amp;nbsp; Make to alternate the order of your queries in any performance tests to try to avoid giving an advantage to the method run first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dataset option COMPRESS will not have any impact on the transfer speed, but depending on whether it actually results in fewer disk blocks being written it might improve the overall speed of a operations using that dataset.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Nov 2018 19:22:55 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-11-12T19:22:55Z</dc:date>
    <item>
      <title>Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512164#M137911</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I wanted to extract the big data from the oracle database. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using a proc&amp;nbsp; sql + libname and with the compress = yes option, I'm doing better than the path through proc sql. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you have an explanation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 12:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512164#M137911</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2018-11-12T12:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512167#M137913</link>
      <description>&lt;P&gt;Not without logs from both scenarios, with appropriate logging options set:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options msglevel=i sastrace=',,,d' sastraceloc=saslog nostsuffix fullstimer;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 12:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512167#M137913</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-11-12T12:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512203#M137918</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Resultats whith sql libname and compress*/


NOTE: Compressing data set WORK.TABLE increased size by 3.23 percent.
      Compressed is 138642 pages; un-compressed would require 134304 pages.
NOTE: Table WORK.data created, with 156598086 rows and 6 columns.

92       quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           9:02.91
      user cpu time       3:53.22
      system cpu time     1:05.57
      memory              5422.90k
      OS Memory           16828.00k
      Timestamp           12/11/2018 03:12:37 PM
      Step Count                        6  Switch Count  613883
      Page Faults                       0
      Page Reclaims                     699
      Page Swaps                        0
      Voluntary Context Switches        3364703
      Involuntary Context Switches      1010209
      Block Input Operations            0
      Block Output Operations           17757080


/*     Result with path through  */

NOTE: Compressing data set WORK.data increased size by 3.23 percent.
      Compressed is 138643 pages; un-compressed would require 134304 pages.
NOTE: Table WORK.data created, with 156598085 rows and 6 columns.

113!  disconnect from oracle;
114
115  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           11:41.58
      user cpu time       3:55.16
      system cpu time     1:06.44
      memory              5321.28k
      OS Memory           17340.00k
      Timestamp           12/11/2018 03:25:04 PM
      Step Count                        7  Switch Count  607470
      Page Faults                       0
      Page Reclaims                     130
      Page Swaps                        0
      Voluntary Context Switches        3349686
      Involuntary Context Switches      1004741
      Block Input Operations            192
      Block Output Operations           17764736


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 14:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512203#M137918</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2018-11-12T14:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512290#M137941</link>
      <description>It seems like COMPRESS isn’t useful in this particular example. No code, so still hard to see. My guess, in this example it doesn’t matter which method you use because it’s a bandwidth issue of where the time is spent transferring the data. Both times are close enough that the difference is likely due to other traffic on your network. Just a guess though given no code.</description>
      <pubDate>Mon, 12 Nov 2018 18:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512290#M137941</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-12T18:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512296#M137942</link>
      <description>&lt;P&gt;I use this code.&lt;/P&gt;&lt;P&gt;The result of proc sql with compress =yes is better then&amp;nbsp; path through&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit ;

options NODBIDIRECTEXEC;

proc sql;

connect to oracle

(PATH="***"  USER="****" PASSWORD="***********" preserve_comments ); 

 create table data as select *

from connection to oracle
(

select  distinct         col1,
                         col2

	from schema.table 
	where    filter1
	and filter2

)
;disconnect from oracle; 

quit; 

endrsubmit ;



rsubmit ;

options compress=yes ;
	  
proc sql; 
    create table data as select col1,
                                col2
	from schema.table 
	where filter1
	and filter2;

quit;

endrsubmit ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 18:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512296#M137942</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2018-11-12T18:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512298#M137944</link>
      <description>I’m assuming you copied and simplified because those programs are not the same and comparing different programs is comparing apples and oranges. Of course a program using distinct would take longer than one not using distinct. &lt;BR /&gt;&lt;BR /&gt;Given the simplicity of the queries I still think this is a network/bandwidth issue.</description>
      <pubDate>Mon, 12 Nov 2018 19:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512298#M137944</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-12T19:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512302#M137946</link>
      <description>&lt;P&gt;Check the definition of the libref SCHEMA.&amp;nbsp; Perhaps you are using different options than you did in your CONNECT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of performance of extracts it is usually the speed of the transfer from the remote database to the SAS server that is most important.&amp;nbsp; So perhaps you have options on your LIBNAME statement that enable SAS to use some bullk or fast transfer procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another issue is that there might be some caching going on in your database. So if you want the explicit query first and then implicit query pulled the same data again the database might respond quicker since the data was already in its cache.&amp;nbsp; Make to alternate the order of your queries in any performance tests to try to avoid giving an advantage to the method run first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dataset option COMPRESS will not have any impact on the transfer speed, but depending on whether it actually results in fewer disk blocks being written it might improve the overall speed of a operations using that dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 19:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512302#M137946</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-12T19:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512313#M137951</link>
      <description>&lt;P&gt;&lt;SPAN&gt;without the distinct, runtimes are the same between the two methods&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm adding options like buffsize, bufno. but for now no big change. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you give me some tips for using these options.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That's what I'm trying to do.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit ;

options NODBIDIRECTEXEC;



 
proc sql;

connect to oracle

(PATH=""  USER="" PASSWORD="" preserve_comments buffsize=500000  ); 

 create table enc_6po( bufsize=500000 BUFNO=100 compress=yes) as 
   select col1 , col2

from connection to oracle
(

select      col1,col2  

	from schema.data 
	where     filter1 and filter2
)
;disconnect from oracle; 

quit; 

endrsubmit ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 19:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512313#M137951</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2018-11-12T19:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sql with sql pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512345#M137975</link>
      <description>&lt;P&gt;The answer to original question, the difference in speed, was different queries. &amp;nbsp;So now I’m assuming your question is how to speed this process up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like a straight copy table with small modifications.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried using a libname and PROC COPY instead to move the table over. That may be faster.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or PROC DOWNLOAD.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add your WHERE using the dataset options.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121317"&gt;@mansour_ib_sas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;without the distinct, runtimes are the same between the two methods&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'm adding options like buffsize, bufno. but for now no big change. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could you give me some tips for using these options.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's what I'm trying to do.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit ;

options NODBIDIRECTEXEC;



 
proc sql;

connect to oracle

(PATH=""  USER="" PASSWORD="" preserve_comments buffsize=500000  ); 

 create table enc_6po( bufsize=500000 BUFNO=100 compress=yes) as 
   select col1 , col2

from connection to oracle
(

select      col1,col2  

	from schema.data 
	where     filter1 and filter2
)
;disconnect from oracle; 

quit; 

endrsubmit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 21:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-sql-with-sql-pass-through/m-p/512345#M137975</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-12T21:05:32Z</dc:date>
    </item>
  </channel>
</rss>

