Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 27th, 2008, 11:24 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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
Reply With Quote
  #2 (permalink)  
Old March 28th, 2008, 08:10 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #3 (permalink)  
Old March 28th, 2008, 06:46 PM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Lakh = million

--Jeff Moden
Reply With Quote
  #4 (permalink)  
Old March 28th, 2008, 06:47 PM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
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
Reply With Quote
  #5 (permalink)  
Old March 30th, 2008, 05:44 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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
Reply With Quote
  #6 (permalink)  
Old March 30th, 2008, 11:52 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #7 (permalink)  
Old March 31st, 2008, 11:24 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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



Gunjan
Reply With Quote
  #8 (permalink)  
Old April 1st, 2008, 04:15 AM
Authorized User
 
Join Date: Jun 2003
Location: Colombo 04, WP, Sri Lanka.
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
Reply With Quote
  #9 (permalink)  
Old April 1st, 2008, 05:02 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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
Reply With Quote
  #10 (permalink)  
Old April 1st, 2008, 06:48 AM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:29 AM.


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