Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There are two views which executes separately fast but when joined becomes slow.How to resolve this?

What I have tried:

I have created Proper Non-Clustered index Index on table.When two views joined I select only expected columns and also there are data is large and when there are live transactions going on then how to resolve this ?Also there are not showing any additional index required in Query execution plan..Then how to resolve this ?
Posted
Updated 11-Jan-19 2:13am
Comments
Santosh kumar Pithani 11-Jan-19 0:26am    
Hi suresh, can you show sample queries and count of records you fetching?
CHill60 11-Jan-19 4:06am    
My spy camera isn't working today. Can you post the details of the views and some sample data.

If you have SQL Server Management Studio installed you can analyze your query with 'Execution plan', see: Display an Actual Execution Plan - SQL Server | Microsoft Docs[^]
 
Share this answer
 
Without seeing the definitions of the TABLEs, VIEW, and how they are being JOINed together, it is really hard to determine what the problem could be.

As RickZeeland answered, it is always best to utilize the Execution Plan viewer is Sql Studio to see what is going on within the query.

My recommendation would be to create a new query by piecing together the query definitions for the existing views and work out the performance issue. I would then create a new view from the resulting query. This will have the advantage of not only being optimized but it will not be dependent upon the other views which may need to be changed sometime in the future
 
Share this answer
 
Hello RickZeeland
thanks for Reply
I already started analyzing views in SQL Execution Plan .
For this
1. First I found unwanted columns after joining Views
2. Non-Clustored Index Created for Views
3. Computed columns avoided in where clause

Issue Resolved ...
Also Sorry Santosh and CHill60 as I couldn't reply you as i started to analyze plan and Thanks
 
Share this answer
 
Comments
Maciej Los 11-Jan-19 7:46am    
This is not an answer. Please, delete it to avoid down-voting.
To post comment, please use "Have a question or comment" widget (under the solution #1) or "Reply" to reply someone's comment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900