Questions tagged [tempdb]

TempDB is part of MS SQL Server. It's a system database that functions as a storage area for temporary tables, internal objects and row versions.

Filter by
Sorted by
Tagged with
22
votes
2answers
2k views

Is it generally faster to select into a temp table than selecting into an actual table?

I thought I once read somewhere that writing to tempdb is faster than an actual table not in tempdb. Is this true in any capacity? I thought I recall it saying something special about tempdb and ...
1
vote
1answer
45 views

65G SQL Server database has 5.5G of data in tempdb when not in use

I have a SQL Server instance with 1 production database (also ReportServer dbs) that is 65G. tempdb is 5.5G (well, actually much bigger but 5.5G is in use) when server is not in use. I believe this ...
0
votes
1answer
66 views

Failed attempt to fetch logical page - tempdb [duplicate]

At least 2 times a week I get an error as the tempdb should be corrupt. Failed attempt to fetch logical page xxxx in database 2. This on all my 8 SQL Servers 2008 R2. The strange thing is that ...
1
vote
0answers
43 views

Test if I have too many TempDB Files

I know there are ways to test for tempdb contention to see if you need to add more tempdb files, but how can I test (and maybe prove) if I have too many tempdb files? I've inherited a relatively ...
2
votes
1answer
77 views

Not able to regulate/auto grow tempdb size

We have a SQL Server 2017 (RTM-CU15) AG group (3 servers, 2 HA synchronous) that has had performance issues for the past two months. During the resolution of an issue yesterday we found that the ...
0
votes
4answers
135 views

Can I change tempdb size to a specific value and can I shrink it during our daily working hours on our production database

Can I change tempdb size to a specific value and can I shrink it during our daily working hours on our production database ?. Please tell me if it has bad effect on a production database. My database ...
0
votes
0answers
22 views

How does DBCC CHECKDB use tempdb?

I would like to know the working principle of DBCC regarding the tempdb. I want to know why it uses tempdb for what purpose. I didn't find any advanced article about that so maybe someone can shortly ...
2
votes
2answers
95 views

Cannot connect to my SQL Management studio after moving a tempDB

In quite a bad position here. This afternoon on my tempDB I ran the query: sp_helpfile to locate where my MDF and LOG file were. My MDF was on my C: drive and my LOG file was on a D: drive so I've ...
0
votes
0answers
79 views

Operator used tempdb to spill data, spill level 1

Here I have a query which is spilling to tempdb. I understand that the cardinality estimates are wrong and causing this spill. I've read few articles that mentions updating the statistics and ...
1
vote
2answers
156 views

Best approach for moving tempdb .ndf files

During a SQL Server installation, I "thought" I specified location of tempdb on 'F:' and not 'C:', but I can see that although tempdb.mdf and templog.ldf are on 'F:', the 3 .ndf secondary data files ...
2
votes
0answers
51 views

Same temp table has created by different session and occurs blocking issue. how to avoid it?

It's a SQL Server 2012 EE. One session (SID=90) executed a JOIN query, and it's generated a temp table internally by SQL Server. But another sessions (SID=103, 109, 110,116) from totally different ...
1
vote
0answers
43 views

Tempdb. There is no enough space on the disc encountered

Does anyone know what really happened here? All of the sudden database was not accessible. How to find transactions that cause tempdb filled up? Seems like it happened right after SQL profiler ...
11
votes
4answers
2k views

Why would shrinking TEMPDB log lead to slowness?

I recently accidentally shrunk tempdb log to almost 0 after getting alerted that log drive filling up. I am told that it will lead to slowness. Can someone please explain why it will lead to slowness?
0
votes
0answers
28 views

When does setting the SORT_IN_TEMPDB option actually improve performance? [duplicate]

My question is related to index rebuilding, mainly the SORT_IN_TEMPDB option. BOL states that: Even if other users are using the database and accessing separate disk addresses, the overall ...
2
votes
1answer
62 views

Does increasing the tempdb file size require a restart

I want to alter tempdb as such (i am increasing the size) USE [master] GO ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'temp2', SIZE = 10240KB ) GO ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'...
1
vote
2answers
82 views

Appropriate tempdb size?

DBCC CHECKDB is failing on a particular database because of Could not allocate space for object 'dbo.SORT temporary run storage: 143479689576448' in database 'tempdb' because the 'PRIMARY' ...
2
votes
1answer
91 views

Is splitting tempdb files across drives necessary?

If I have 4 tempdb files split across 2 drives with the log on a third drive, is that necessary/helpful? I want to persuade my manager to put all 4 tempdb files on one drive. If one of those tempdb ...
0
votes
1answer
99 views

How to exclude tempdb from sp_MSforeachdb?

Below I have a code to get info about t-log backups for each database in the server. I want to exclude tempdb from this list. exec sp_MSforeachdb 'SELECT server_name, sysdb.name AS DatabaseName, bkup....
0
votes
1answer
76 views

Enabling write caching for TempDb data drives

Recently, we had issues with slowness for some queries where TempDb latencies on their respective drives had spikes. We already have 8 tempdb files and trace flags 1117 and 1118 are not enabled. We ...
12
votes
2answers
583 views

What is hot spotting in the context of adding files to tempdb?

I'm trying to find out whether it is possible to add tempdb files to a SQL Server without having to restart the SQL Server service. I saw this answer here on Database Administrators: Tempdb Add files ...
16
votes
2answers
2k views

What happens when there is no available physical memory left for SQL Server?

While googling I found some conflicting information. Some sites state that when there is no physical memory left for data, then SQL Server moves the already existing data into TEMPDB (see: SQL Server:...
0
votes
1answer
24 views

tempdb move issue

In preparation for moving many of my databases in a data warehouse to READ COMMITTED SNAPSHOT isolation level (CDC and Reads contend for locks) I added a drive and moved my tempdb there (mdf and ldf) ...
1
vote
2answers
124 views

Need to move TempDB to another drive. But its files cannot be dropped or shrunk

Today I had a task to move all TempDB files to a new, smaller drive (RAMdisk). I analysed TempDB files space usage - not all the space inside of its files was used so I decided that new drive is ok. ...
1
vote
1answer
194 views

TempDB Transaction log not releasing space

Every time I complete a transaction in tempdb, the temp log grows, however the log doesn't seem to release the space once the transaction has completed.The log usage percent is 43.4% but seems to ...
0
votes
1answer
81 views

TempDB file overflow

This is my experience with TempDB. The Algorithm works better when the TempDB File sizes are the same size. We were seeing heavy TempDB contention on a TempDB file that was larger than the others. ...
0
votes
0answers
50 views

Setting up TempDB for more than one instance of SQL Server

I've been given the task of transferring the contents of a SQL Server instance from one Windows server to another Windows Server. One of the many things I need to do on the new server is set up the ...
1
vote
1answer
274 views

SQL Server sys.dm_tran_active_transactions long running transaction worktable

today I used the system object sys.dm_tran_active_transactions (to be honest for the first time). I had an issue with distributed transactions (Microsoft DTC) and went digging there after I had no ...
0
votes
0answers
28 views

SQL Server tempDB data file is growing very fast. 120gb

My tempDB is now over 120GB. It has grown 65GB in a couple of hours. It is not the log but the actual DB that is growing. Reports show 99% is unused space. I tried restarting the server that SQL ...
2
votes
2answers
103 views

A very strange thing in the tempdb [closed]

In all the following scenarios on my laptop, all the tables in the SSMS Tables folder will be deleted from tempdb: Instance Restart; Stop & Start SQL Server Service; End Task SQL Server process ...
1
vote
1answer
186 views

SQL Server tempdb log file isn't autogrowing, instead getting error “The transaction log for database 'tempdb' is full due to 'ACTIVE_TRANSACTION'” [closed]

FYI: moved from Stack Overflow https://stackoverflow.com/questions/56350491/sql-server-tempdb-log-file-isnt-autogrowing-instead-getting-error-the-transac I'm using SQL Server 2016 and am encountering ...
1
vote
1answer
146 views

Troubleshooting TempDB for Performance Bottlenecks

While trying to investigate some performance issues with our SQL Server database, I've noticed our wait statistics seem high for ASYNC_IO_COMPLETION and PAGEIOLATCH_*. In Resource Monitor I noticed ...
5
votes
3answers
180 views

“tempdb metadata memory-optimized” configuration option

Checking SQL Server 2019 CTP 2.5 (15.0.1500.28) I found this new configuration option and was wandering what is behind it. Couldn't find any information so far and was wondering if you know where to ...
3
votes
1answer
398 views

Log for database tempdb is not available

I have been struggling with this issue from so many months now, I am saying its not a database issue and assigning this case to Storage and Operating system team and they are assigning it to me ...
1
vote
1answer
329 views

In memory table vs temporary table - benefits if temdb in already on ram disk

In the docs, we have example of how temporary tables can be replaced with in-memory tables and because a memory-optimized table: is stored only in memory, and has no component on disk involves no IO ...
0
votes
0answers
41 views

My Temp db is full [duplicate]

What to do when tempdb is full ? I would like to know if tempdb has become full and what to do if you can't truncate the log? I want to understand the process why you can't truncate it.
1
vote
3answers
57 views

When I connect to DB, always connects as tempdb

I am trying to run a sybase DB query from a jsp session. I can connect to the DB fine, but when I run my query, by default it always runs against tempdb. Is there a way I can make a connection to ...
1
vote
0answers
135 views

How we can clear tempdb without restart MSSQL service [duplicate]

While checking my tempdb details, its showing that almost 90 GB is consumed. So I tried clearing all caches and perform shrinking, but still it's consuming 90 GB of space. My drive became full where ...
2
votes
0answers
151 views

Aggressive Tempdb spill process

We are having an issue with aggressive tempdb spills that significantly effect overall server performance and, in rare cases, cause AlwaysOn failures. Tested on SQL2016 and SQL2017 Enterprise (recent ...
0
votes
1answer
393 views

Should TempDB SSD Drive be formatted with 64 Kb Allocation Unit Size?

We have installed dedicated SSD drives for TempDB First question - should these drives be formatted with 64 Kb allocation size ? Currently it shows 4 Kb (Bytes per Cluster = 4096) Does TempDB ...
1
vote
1answer
110 views

Understanding the TempDB growth

Need to understand below behavior of tempdb:- Due to some poor running queries which caused Tempdb bloating, we had shrink and tried to adjust the sizes of each tempdb file: Before issue: no of ...
2
votes
1answer
1k views

How to clear temp database content in SQL Server?

As the title implies, I am going to clear the content of my temp database in SQL Server. SolarWinds is generating a critical alert and I want to clear the tempdb workfiles and worktables. How can I ...
4
votes
1answer
104 views

SQL Server 2016 still uses mixed_extent_allocation in TempDB

Today I was troubleshooting a problem on TempDB on SQL Server 2016 SP2 using extended events and added the mixed_extent_allocation and transaction_log event to my trace. I expected ...
5
votes
3answers
1k views

How to inspect global temp table from outside the transaction it is created in

To help debugging a batch of SQL (that is run inside a transaction), inside the transaction I dump some data into a global temporary table. The global temporary table is created inside the transaction ...
3
votes
1answer
380 views

SQL Server 2016 with high tempdb usage and low RAM usage

I've got a small instance of SQL Server Standard that I'm running HammerDB TPC-H (1 GB) benchmarks on. It's got some configuration issue though where it's writing everything into tempdb on disk, and ...
1
vote
1answer
304 views

Tempdb ndf files on different drives

So I inherited a server that has serious write latency issues according to a script provided by glen berry, I also noticed that the tempdb files are spread across multiple drives. What could be the ...
14
votes
1answer
435 views

Sort spills to tempdb but estimated rows equals to actual rows

On a SQL Server 2016 SP2 with max memory set to 25GB we have a query that executes about 80 times in a minute. The query spills about 4000 pages to tempdb. This causes for a lot of IO on the disk of ...
10
votes
3answers
520 views

Sort spills to tempdb due to varchar(max)

On a server with 32GB we are running SQL Server 2014 SP2 with a max memory of 25GB we have two tables, here you find a simplified structure of both tables: CREATE TABLE [dbo].[Settings]( [id] [...
7
votes
4answers
701 views

Does LocalDB support temporary tables?

Are SQL Server temporary tables (prefixed with #) supported in LocalDB instances?
0
votes
0answers
917 views

Unexplainable write latency tempdb

I have a virtual SQL Server 2016 SP2 CU2 with SAN storage. TempDB has 8 files. I know it is recommended to put TempDB on SSD but TempDB is hardly used so spinning disks are cheaper. I've noticed that ...
3
votes
2answers
719 views

Memory issues: Tempdb using Almost all of the buffer cache

On one of the servers I am working on today, i see that almost all of the buffer cache is filled by tempdb. As a result memory is very low on the server. CPU Tempdb: Version: Microsoft SQL ...