You can translate the question and the replies:

One of our View is running longer.

Hi, One of our query is running longer. Scenario-1: We have created one view to get some columns( using case statements) and used 4 to 5 sub queries and joined them individually with main table. Scenario-2: We have modified the Scenario-1 query like mentioned below: --> Created separate views for each sub queries and Joined them individually with main table. In Both the scenario's view is running longer. In Dev/Test Environment , View is almost taking 10 to 15 mins to show output/Result. In Local environment, view is running for 2 to 3 mins and failing with "SQL Server did not return a response. The connection has been closed" Could you please check and assist on above issue
user
16-01-2023 09:53:40 -0500
code

1 Answer

Hi, Since you are using CASE statements and subqueries in your views, I think there's a chance that your query is not getting delegated to your data source, therefore the performance is slow. You can verify this if you check the** execution trace** of the view when you run it. You can refer to this [article](https://community.denodo.com/kb/en/view/document/Getting%20the%20SQL%20query%20delegated%20by%20a%20derived%20view) as reference, which shows an example to navigate on the execution trace to identify query delegation to the source. You can also check this documentation for more information on the different [Data Source Configuration Properties](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/data_source_configuration_properties/data_source_configuration_properties), specially on **delegating scalar functions**. I find this Knowledge Base article regarding [Best Practices in detecting query performance bottlenecks](https://community.denodo.com/kb/en/view/document/Best%20Practices%20to%20Maximize%20Performance%20IV:%20Detecting%20Bottlenecks%20in%20a%20Query?category=Best%20Practices) a good reference to start when debugging. As for the error message in your local environment, “*SQL Server did not return a response. The connection has been closed*” I suggest to double check the following in your local environment: * Are you using the same driver as in Dev/Test environment? * Are the data source connection details correct? * Can you establish a connection directly to the data source with SQL Management Studio? Hope this helps.
Denodo Team
26-01-2023 18:05:12 -0500
code
You must sign in to add an answer. If you do not have an account, you can register here