December 25, 2017 at 10:14 pm
Hi,
I have a huge insert/update operation performing in set of tables. The process tooks almost 1-2 hours to complete. Meanwhile tempdb is growing fast and most of my applications using the sql server gets hung during that time.
To overcome this Replacing the stored procedure with SSIS will help in my scenario???
Please share your valuable inputs. Thanks in advance!
Chelladurai
December 26, 2017 at 6:04 am
haichells - Monday, December 25, 2017 10:14 PMHi,I have a huge insert/update operation performing in set of tables. The process tooks almost 1-2 hours to complete. Meanwhile tempdb is growing fast and most of my applications using the sql server gets hung during that time.
To overcome this Replacing the stored procedure with SSIS will help in my scenario???
Please share your valuable inputs. Thanks in advance!
Chelladurai
No. It won't help if you do similar as to what you did in the stored procedure. What needs to happen is you need to step back and look at the code. Code that blows out TempDB is a very strong indication that you have some accidental many-to-many joins and you need to fix that problem no matter what you use.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 26, 2017 at 6:27 am
The accidental many-to-many join that Jeff mentioned is a possibility. So is an implicit cast that required you to read an entire table is another, but there are others. Take a look at your query plan and look for the yellow triangle icon on one of your steps. Mouseover the icon and look for the warning near the bottom of the tooltip.
December 26, 2017 at 6:33 am
Is it possible you are returning a very (unneccessarily) large result set that is being stored in TempDB as part of a single transaction before being filtered and sorted? Is your transaction log similarly bloated?
If that is the case try breaking down the transaction into smaller more manageble transactions.
Also, if other applications are affected as a result of file contention (as I assume it might be) try adding more files to TempDB. You will need to look in the logfiles to see if this is happening.
If you decide to add more files, have a look at this first:
https://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1230-tempdb-should-always-have-one-data-file-per-processor-core/
As mentioned in the link, trace flag 1118 could help mitigate some problems if you haven't already turned it on and aren't already on SQL Server 2016.
Is it possible for you to post the stored procedure code so we can have a look at it?
December 26, 2017 at 6:55 am
kevaburg - Tuesday, December 26, 2017 6:33 AMIs it possible you are returning a very (unneccessarily) large result set that is being stored in TempDB as part of a single transaction before being filtered and sorted? Is your transaction log similarly bloated?If that is the case try breaking down the transaction into smaller more manageble transactions.
Also, if other applications are affected as a result of file contention (as I assume it might be) try adding more files to TempDB. You will need to look in the logfiles to see if this is happening.
If you decide to add more files, have a look at this first:
https://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1230-tempdb-should-always-have-one-data-file-per-processor-core/As mentioned in the link, trace flag 1118 could help mitigate some problems if you haven't already turned it on and aren't already on SQL Server 2016.
Is it possible for you to post the stored procedure code so we can have a look at it?
For SQL Server 2016 and up, you have no real choice... Trace Flag 1118 is on whether you want it to be or not.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 26, 2017 at 9:25 am
Jeff Moden - Tuesday, December 26, 2017 6:55 AMkevaburg - Tuesday, December 26, 2017 6:33 AMIs it possible you are returning a very (unneccessarily) large result set that is being stored in TempDB as part of a single transaction before being filtered and sorted? Is your transaction log similarly bloated?If that is the case try breaking down the transaction into smaller more manageble transactions.
Also, if other applications are affected as a result of file contention (as I assume it might be) try adding more files to TempDB. You will need to look in the logfiles to see if this is happening.
If you decide to add more files, have a look at this first:
https://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1230-tempdb-should-always-have-one-data-file-per-processor-core/As mentioned in the link, trace flag 1118 could help mitigate some problems if you haven't already turned it on and aren't already on SQL Server 2016.
Is it possible for you to post the stored procedure code so we can have a look at it?
For SQL Server 2016 and up, you have no real choice... Trace Flag 1118 is on whether you want it to be or not.
I only mentioned it because the OP hasn't mentioned what SQL Server version he is using....
December 26, 2017 at 10:54 am
kevaburg - Tuesday, December 26, 2017 9:25 AMJeff Moden - Tuesday, December 26, 2017 6:55 AMkevaburg - Tuesday, December 26, 2017 6:33 AMIs it possible you are returning a very (unneccessarily) large result set that is being stored in TempDB as part of a single transaction before being filtered and sorted? Is your transaction log similarly bloated?If that is the case try breaking down the transaction into smaller more manageble transactions.
Also, if other applications are affected as a result of file contention (as I assume it might be) try adding more files to TempDB. You will need to look in the logfiles to see if this is happening.
If you decide to add more files, have a look at this first:
https://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1230-tempdb-should-always-have-one-data-file-per-processor-core/As mentioned in the link, trace flag 1118 could help mitigate some problems if you haven't already turned it on and aren't already on SQL Server 2016.
Is it possible for you to post the stored procedure code so we can have a look at it?
For SQL Server 2016 and up, you have no real choice... Trace Flag 1118 is on whether you want it to be or not.
I only mentioned it because the OP hasn't mentioned what SQL Server version he is using....
Understood and very much appreciated. I made the probable bad assumption that the OP posted in a 2017 forum because that's what he was using. That's frequently a really bad assumption as we've seen so often in the past.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 26, 2017 at 9:52 pm
Dear All,
Thanks a lot for your ideas! I will try to refine the sql statements also i will check the plan and if i need any help i will get back to you. Thanks again!
Chelladurai
December 27, 2017 at 7:25 am
haichells - Tuesday, December 26, 2017 9:52 PMDear All,Thanks a lot for your ideas! I will try to refine the sql statements also i will check the plan and if i need any help i will get back to you. Thanks again!
Chelladurai
If you want, we might be able to help a bit if you posted the stored procedures (to start with) as attachments (txt file).
--Jeff Moden
Change is inevitable... Change for the better is not.
December 27, 2017 at 8:40 am
This was removed by the editor as SPAM
January 4, 2018 at 3:55 pm
If tempdb data and log files had been inflated by your previous operation, what would happen now if you repeat it now? Was it tempdb log file that was growing or it happened to its data file as well?
Is Instant File Initialization turned on? (this would only affect tempdb data file)
Are you prepared to monitor tempdb log file usage as the operation is in progress next time?
June 14, 2018 at 11:58 pm
This was removed by the editor as SPAM
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply