August 30, 2011 at 10:31 pm
I have two views joining on accountID.
--------------------------
Main query of the report
--------------------------
select a.*, b.xx
from view_a as a
join view b as b
on a.accountid = b.accountid
When querying each view individually, it works fine. View_a takes about a minute to get the result and view_b takes about 1.5-2 minutes.
But when two views join together, the query takes so long time about 30-40 minutes.
I don't really have no idea why it is so slow when joining views together. If anyone knows how to make it quicker, please let me know.
Thank you very much.
August 31, 2011 at 1:02 am
Without the internals of those views, their underlying tables and some test data we can not do much for you. Please provide some more details and people here will be happy to help.
edit: I've seen "wonders" done to the performance of queries after posting a query plan. Posting one for your query will help people here help you too.
August 31, 2011 at 1:12 am
Posting the actual execution plan would be extremely helpful in this case. As has been said, if you can get us more info - more people can help you faster and better.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 31, 2011 at 8:45 am
I'm new to SQL server. I have no idea how to paste the whole execution plan to this discussion board as both the views are huge sql scripts. Any recommendation, pls let me know.
Thank you.
August 31, 2011 at 10:19 am
Read the first article in my sig. Gail walks you through how to post that info.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 1, 2011 at 11:12 am
I could find the work around by creating temp tables of two views and then join temp tables together.
The performance improved 100%. I'm not quite understand the reason behind that but it works anyway. 🙂
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply