SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Tempdb growth


Tempdb growth

Author
Message
haichells
haichells
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2180 Visits: 529
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
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)

Group: General Forum Members
Points: 872844 Visits: 47501
haichells - Monday, December 25, 2017 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


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

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Ed Wagner
Ed Wagner
SSC Guru
SSC Guru (264K reputation)SSC Guru (264K reputation)SSC Guru (264K reputation)SSC Guru (264K reputation)SSC Guru (264K reputation)SSC Guru (264K reputation)SSC Guru (264K reputation)SSC Guru (264K reputation)

Group: General Forum Members
Points: 264607 Visits: 12286
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.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
kevaburg
kevaburg
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16142 Visits: 1283
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?
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)

Group: General Forum Members
Points: 872844 Visits: 47501
kevaburg - Tuesday, December 26, 2017 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?


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

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
kevaburg
kevaburg
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16142 Visits: 1283
Jeff Moden - Tuesday, December 26, 2017 6:55 AM
kevaburg - Tuesday, December 26, 2017 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?


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....
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)

Group: General Forum Members
Points: 872844 Visits: 47501
kevaburg - Tuesday, December 26, 2017 9:25 AM
Jeff Moden - Tuesday, December 26, 2017 6:55 AM
kevaburg - Tuesday, December 26, 2017 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?


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

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
haichells
haichells
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2180 Visits: 529
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
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)SSC Guru (872K reputation)

Group: General Forum Members
Points: 872844 Visits: 47501
haichells - Tuesday, December 26, 2017 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


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

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Subramaniam Chandrasekar
Subramaniam Chandrasekar
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3516 Visits: 531
Jeff Moden - Tuesday, December 26, 2017 6:04 AM
haichells - Monday, December 25, 2017 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


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.

Hi Chelladurai,
Yes, We need to look at your code as Jeff mentioned, Lets consider your SQL DML statements like a CAR which has been running on a road and it reaches the destination in two hours but usually any car will reach it in 20mins.
In this case, What you were asking about riding your car in an another or any other road, Still it will reach the destination in two hours. But the actual travelling time would be 20mins for other cars.
So we can conclude that the problem was with your CAR / DML statements not with the ROAD / not even gets resolved if you switch this in SSIS.
Hope I've clarified you, thanks !

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search