<?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: What is the difference between Open Database() and New SQL Query() when accessing databases? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226733#M44989</link>
    <description>&lt;P&gt;Hi Brian,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example, the Open Database is doing a SELECT * and just grabbing all the data.&amp;nbsp; This is going to be much faster then executing the WHERE clause that you have in the Query Builder script.&amp;nbsp; Also, you are doing a Modify on the Query Builder to bring up the UI.&amp;nbsp; You might want to try Run Background() there instead to run the query on a background thread.&amp;nbsp; Without seeing all of the data, I think removing the WHERE clause on the Query Builder script and grabbing all of the data would likely be faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brian Corcoran&lt;/P&gt;
&lt;P&gt;JMP Development&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 12:10:31 GMT</pubDate>
    <dc:creator>briancorcoran</dc:creator>
    <dc:date>2019-09-23T12:10:31Z</dc:date>
    <item>
      <title>What is the difference between Open Database() and New SQL Query() when accessing databases?</title>
      <link>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226611#M44960</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to pull down a view from an Oracle database.&amp;nbsp; The Data Base Name&amp;nbsp;is ACTPROD.WORLD, Schema is ABASE, and Table is RPT_H25_3MONTHS_VIEW&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using Database -&amp;gt; Open Table, JMP created the following script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Open Database(
	"DSN=ACTPROD.WORLD;UID=;PWD=;DBQ=ACTPROD.WORLD;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;STE=F;TSZ=8192;AST=FLOAT;",
	"SELECT * FROM \!"ABASE\!".\!"RPT_H25_3MONTHS_VIEW\!""
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This script opens a data table in &amp;lt;5min, but we would like to be able to modify the query&amp;nbsp;using the Query Builder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using Database -&amp;gt; Query Builder, JMP created the following script.&amp;nbsp; This script takes &amp;gt;3hrs just to load the Query Builder UI.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New SQL Query(
	Version( 130 ),
	Connection(
		"ODBC:DSN=ACTPROD.WORLD;UID=;PWD;DBQ=ACTPROD.WORLD;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;STE=F;TSZ=8192;AST=FLOAT;"
	),
	QueryName( "RPT_H25_3MONTHS_VIEW" ),
	Select(
		Column( "TEST_ID", "t1" ),
		Column( "OBJECT", "t1" ),
		Column( "BATCH", "t1" ),
		Column( "WELL", "t1" ),
		Column( "PLATE", "t1" ),
		Column( "SEQUENCE", "t1" ),
		Column( "%C(%)", "t1" ),
		Column( "RATE", "t1" ),
		Column( "RATE_UNIT", "t1" ),
		Column( "REPLICATE", "t1" ),
		Column( "SOIL", "t1" ),
		Column( "SPECIES_ABBR", "t1" ),
		Column(
			"CREATED_DATE",
			"t1",
			Numeric Format( "m/d/y h:m:s", "0", "NO", "" )
		)
	),
	From( Table( "RPT_H25_3MONTHS_VIEW", Schema( "ABASE" ), Alias( "t1" ) ) ),
	Where(
		In List(
			Column( "TEST_ID", "t1" ),
			{"H2.5-20190618", "H2.5-20190723", "H2.5-20190806"},
			UI( SelectListFilter( ListBox, Base( "Categorical" ) ) )
		) &amp;amp; Is Not Null(
			Column( "%C(%)", "t1" ),
			UI( NullTest( Base( "Continuous" ) ) )
		)
	)
) &amp;lt;&amp;lt; Modify&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What are the Open Database and New SQL Query scripts doing differently that causes such a discrepancy in execution time?&amp;nbsp; Is there a way to speed up execution of Query Builder or incorporate the Query Builder UI into the Open Database script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am really new to working with databases, it would be very helpful if you could be detailed in your replies so I can learn.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 16:46:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226611#M44960</guid>
      <dc:creator>BrianG</dc:creator>
      <dc:date>2019-09-20T16:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: What is the difference between Open Database() and New SQL Query() when accessing databases?</title>
      <link>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226733#M44989</link>
      <description>&lt;P&gt;Hi Brian,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example, the Open Database is doing a SELECT * and just grabbing all the data.&amp;nbsp; This is going to be much faster then executing the WHERE clause that you have in the Query Builder script.&amp;nbsp; Also, you are doing a Modify on the Query Builder to bring up the UI.&amp;nbsp; You might want to try Run Background() there instead to run the query on a background thread.&amp;nbsp; Without seeing all of the data, I think removing the WHERE clause on the Query Builder script and grabbing all of the data would likely be faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brian Corcoran&lt;/P&gt;
&lt;P&gt;JMP Development&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 12:10:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226733#M44989</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2019-09-23T12:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: What is the difference between Open Database() and New SQL Query() when accessing databases?</title>
      <link>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226766#M44994</link>
      <description>&lt;P&gt;You might need one or more indexes on your table for more efficient querying with a WHERE clause.&amp;nbsp; I would suggest tuning your query in an interactive Oracle tool like PL/SQL Developer, Toad, etc.&amp;nbsp; Use EXPLAIN PLAN to see what's costing you the most in your query, and to identify where an index would be helpful.&amp;nbsp; Once your query is tuned use either OPEN DATABASE or EXECUTE SQL to run it.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 14:09:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226766#M44994</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-09-23T14:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: What is the difference between Open Database() and New SQL Query() when accessing databases?</title>
      <link>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226821#M45004</link>
      <description>&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried removing the WHERE clause and using Run Background, but the execution time is still 3+hrs&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New SQL Query(
	Version( 130 ),
	Connection(
		"ODBC:DSN=ACTPROD.WORLD;UID=;PWD=;DBQ=ACTPROD.WORLD;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;STE=F;TSZ=8192;AST=FLOAT;"
	),
	QueryName( "RPT_H25_3MONTHS_VIEW" ),
	Select(
		Column( "TEST_ID", "t1" ),
		Column( "OBJECT", "t1" ),
		Column( "BATCH", "t1" ),
		Column( "WELL", "t1" ),
		Column( "PLATE", "t1" ),
		Column( "SEQUENCE", "t1" ),
		Column( "%C(%)", "t1" ),
		Column( "RATE", "t1" ),
		Column( "RATE_UNIT", "t1" ),
		Column( "REPLICATE", "t1" ),
		Column( "SOIL", "t1" ),
		Column( "SPECIES_ABBR", "t1" ),
		Column( "CREATED_DATE", "t1", Numeric Format( "m/d/y h:m:s", "0", "NO", "" ) )
	),
	From( Table( "RPT_H25_3MONTHS_VIEW", Schema( "ABASE" ), Alias( "t1" ) ) )
		
) &amp;lt;&amp;lt; Run Background()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a way to use SELECT * with the New SQL Query() script I tried the following&amp;nbsp;but am getting a syntax error.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New SQL Query(
	Version( 130 ),
	Connection(
		"ODBC:DSN=ACTPROD.WORLD;UID=;PWD=;DBQ=ACTPROD.WORLD;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;MLD=0;ODA=F;STE=F;TSZ=8192;AST=FLOAT;"
	),
	QueryName( "RPT_H25_3MONTHS_VIEW" ),
	Select("*"),
	From( Table( "RPT_H25_3MONTHS_VIEW", Schema( "ABASE" ), Alias( "t1" ) ) )
		
) &amp;lt;&amp;lt; Run Background()
		&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 19:10:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226821#M45004</guid>
      <dc:creator>BrianG</dc:creator>
      <dc:date>2019-09-23T19:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: What is the difference between Open Database() and New SQL Query() when accessing databases?</title>
      <link>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226824#M45005</link>
      <description>&lt;P&gt;Hi Brian,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I'm sorry, but Query Builder does not accept *.&amp;nbsp; I think you probably need to follow Peter's tuning suggestion, or stick with Open Database or Execute SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 19:15:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/What-is-the-difference-between-Open-Database-and-New-SQL-Query/m-p/226824#M45005</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2019-09-23T19:15:34Z</dc:date>
    </item>
  </channel>
</rss>

