<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Query Database Smart Service</title><link>https://community.appian.com/discussions/f/data/11274/query-database-smart-service</link><description>We have a use case where we need to pull data from another system. The only way to access the data in the other system is by querying the data from its MS SQL Server Database. The data is in a view. I&amp;#39;ve built a CDT and mapped it to the view and created</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/51635?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 14:15:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d2e1508b-075b-4e50-8679-d20e7b9164a4</guid><dc:creator>jayakumars</dc:creator><description>Thanks for providing an update. Happy to hear you were able to resolve your issue.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49635?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 11:16:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3db0354c-547f-4dad-8d37-b62ae5bd682c</guid><dc:creator>bryant.st39</dc:creator><description>Quick update...we created a new smart service that we pass two parameters to (1. JNDI of the data-source, 2. SQL string (ex.  =&amp;quot;select * from evm.projectEVDataView where subprojectId = &amp;quot; &amp;amp; pv!subprojectId)...the smart service returns a JSON with the desired data, in an acceptable time (&amp;lt; 500 ms)...we are now implementing some security measures on the smart service to prevent &amp;quot;bad stuff&amp;quot; from &amp;quot;accidentally&amp;quot; happening...&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49609?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 01:53:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a22bcff3-aef8-43e8-a6bb-3e60ae494358</guid><dc:creator>manikandanp13</dc:creator><description>not sure it is possible to create another view with required data in the source system and then just simple select from that view&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49597?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 13:24:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a6e77569-1a31-4661-908d-90f07b2dff69</guid><dc:creator>bryant.st39</dc:creator><description>I can confirm that it is returning data and that the node is not stuck.  Glad I&amp;#39;m not the only that finds this odd..lol...We are close to being ready to test our new smart service.  I&amp;#39;ll update any progress here.  Thanks.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49565?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2017 18:01:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:574c603e-7472-49e9-ae14-fe49ba2da443</guid><dc:creator>chandu</dc:creator><description>This is interesting if there is a view problem then, running the query with hardcoded value should take more time , In your case its taking more time only when where clause is not hard coded. Strange one. Please confirm this are u getting data after 2 mins? are node got simply struck? Please post back here how u resolved this. I will have a try.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49535?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2017 15:54:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cd3ab3ab-9fbb-4d8b-91ea-186d5436284d</guid><dc:creator>bryant.st39</dc:creator><description>Not sure how much more performance I can get from the query or the view that I am querying, my real concern is over the drastic difference in performance on the Appian side between using an ACP to define a dynamic parameter for the &amp;quot;where&amp;quot; condition versus hard-coding a value into that condition.  When executed from SQL command line, the  query can pull 4 rows of data in less than 100 milliseconds.  When executing using hard-coded values in the &amp;quot;where&amp;quot; condition using the Query DB Smart Service, I get similar response time.  However, by simply substituing the hard-coded values for an ACP that I set external that node now takes &amp;gt; 2 minutes to exectute.  Seems more like an Appian related issue than a database problem.&lt;br /&gt;
&lt;br /&gt;
Using the Query Database Smart Service:&lt;br /&gt;
method 1: select bac, acwp, bcws, bcwp from evm.subprojectevdata where subprojectid = 20321, &amp;lt; 100 milliseconds to execute&lt;br /&gt;
method 2:  select bac, acwp, bcws, bcwp from evm.subprojectevdata where subprojectid = ac!subprojectId,   &amp;gt;2 mins to execute, with ac!subproject = 20321&lt;br /&gt;
&lt;br /&gt;
We are trying to do this to create a snapshot table to reduce the impact of extremely poor table design in another system.  Right now, we are developing a smart service to perform the query...not sure if that will improve performance or not.&lt;br /&gt;
&lt;br /&gt;
Thanks for recommendations...we&amp;#39;ll rexamine our efforts in those areas.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49528?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2017 13:25:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d616109d-33e1-4c8b-bef8-f5fd65b3bbf5</guid><dc:creator>Colton Beck</dc:creator><description>I agree with Jamal&amp;#39;s estimation. To improve performance, could you update the source to be a materialized view or some snapshot table that&amp;#39;s updated at regular intervals?&lt;br /&gt;
&lt;br /&gt;
If that&amp;#39;s not possible, you can look into adding indexes or refactoring the query to be more performant.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49527?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2017 12:01:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b6ffa15f-59cf-4764-a10a-12ebab7e481c</guid><dc:creator>bryant.st39</dc:creator><description>We&amp;#39;ve reduced batch size to 1, no impact.  We&amp;#39;ve tested query performance directly in DB and it executes in well under 1 sec.  We&amp;#39;ve tested using the query DB smart service, mixed results depending on whether the &amp;quot;where&amp;quot; parameter is hard-coded or not.  Unfortunately, we cannot reduce any subqueries because of the way the data is organized in the tables.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query Database Smart Service</title><link>https://community.appian.com/thread/49526?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2017 11:55:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:366d621d-ec37-4a59-a635-449e4027f714</guid><dc:creator>Jamal Case</dc:creator><description>It looks like that view has a performance issue. Too many rows may be getting return causing that view to timeout on the Appian side. Lower the batch size and try running it again. You may want to make sure you&amp;#39;re following best practices. I know removing sub-queries  and joining on tables has better performance.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>