Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 27th, 2008, 11:24 PM
Authorized User
 
Join Date: Apr 2007
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default View returns huge data,taking more time

Hi,

I have a view which returns around thirty Lakh records. And is taking more time to execute.
The View has around 11 tables in which some of the tables are left joined .. which is resulting in a huge data .....
Is there any way i can make the execution faster?

Kindly help.

Thanks.

Gunjan
__________________
Gunjan
 
Old March 28th, 2008, 08:10 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What is "Lakh"?

Have you optimized the table with indexes? Do they all need to be joined with LEFT joins? Is all the data you are getting the data you actually want?

-Peter
peterlanoie.blog
 
Old March 28th, 2008, 06:46 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Lakh = million

--Jeff Moden
 
Old March 28th, 2008, 06:47 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Quote:
quote:Originally posted by gunjan.sh
 Hi,

I have a view which returns around thirty Lakh records. And is taking more time to execute.
The View has around 11 tables in which some of the tables are left joined .. which is resulting in a huge data .....
Is there any way i can make the execution faster?

Kindly help.

Thanks.

Gunjan
Indexes may help but only if the query in the view is "sargeable". Post the code.

--Jeff Moden
 
Old March 30th, 2008, 05:44 AM
Authorized User
 
Join Date: Apr 2007
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
I need all the data returned by doing left joins ...
And have sufficient indexes on the base Tables ...
But still it's getting timed out because of the huge data returned.


Thanks.

Gunjan
 
Old March 30th, 2008, 11:52 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Then I'm not sure you'll be able to get more out of it. Have you profiled and tested your query to see if there is something in there that could be optimized?

-Peter
peterlanoie.blog
 
Old March 31st, 2008, 11:24 PM
Authorized User
 
Join Date: Apr 2007
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did run the profiler ... but that also was of no help ....



Gunjan
 
Old April 1st, 2008, 04:15 AM
Authorized User
 
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Preethi Send a message via Yahoo to Preethi
Default

You may have a couple of options
1. Do you need all the data at once? If not, divide the data into multiple chunks and receive them one by one. One possible option (I don't know your data but making a wild guess) is breaking the data based on the year (or month if you have only one year's data) or year and month. You may execute the query for every month. To do this in a few you need to add a temp table with only one row having the start date and end date You can loop through to get the whole data

2. Increase query timeout. You can sent it to 0 and the application will wait until SQL Server responds



G.R.Preethiviraj Kulasingham
 
Old April 1st, 2008, 05:02 AM
Authorized User
 
Join Date: Apr 2007
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can u please tell me how to increase the time out period ?

Thanks in advance.

Gunjan
 
Old April 1st, 2008, 06:48 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Increasing the time out period is, at best, a short term patch... not a fix. You'll probably find the real problem in the code in the view... the view probably needs to be rewritten but no one can tell because the code for the view has not been posted.

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid taking huge render time gunjan.sh ASP.NET 2.0 Basics 1 June 4th, 2008 07:40 AM
MTOM taking more time than base64 method shahzadgodil .NET Web Services 0 February 27th, 2007 02:51 AM
How to work through huge amounts of data effective Planet_Jeroen Excel VBA 2 January 16th, 2007 08:12 AM
taking particular data .. anukagni Access 2 August 4th, 2006 12:05 AM
Autofilter taking too much of time raaghu15 Excel VBA 2 March 4th, 2005 05:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.