Click here to Skip to main content
13,828,588 members
Rate this:
 
Please Sign up or sign in to vote.
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 4 days ago
Comments
   
Hi suresh, can you show sample queries and count of records you fetching?
CHill60 4 days ago
   
My spy camera isn't working today. Can you post the details of the views and some sample data.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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[^]
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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
   
Comments
Maciej Los 4 days ago
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190114.1 | Last Updated 11 Jan 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100