Sql-server – “The transaction log for database ‘tempdb’ is full due to ‘ACTIVE_TRANSACTION’.” after adding indexes to temp tables

indexsql serversql server 2014tempdbtemporary-tables

Recently, I added some indexes on temp tables to procedures which prepare data for data warehouse. On a testing db, tests of these procedures worked fine but when running on client's server it failed due to this error and the server needed to be restarted. Can this be related to adding the indexes or it could be something totally else?

Client's server version:

  • Microsoft SQL Server 2014 (SP3) (KB4022619) – 12.0.6024.0 (X64)
    Enterprise Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)

Testing server version:

  • Microsoft SQL Server 2014 – 12.0.4100.1 (X64) Developer Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)

Best Answer

An index create on a temp table will use space in the tempdb transaction log while the index is being built. So yes, the index could have caused the issue in the general sense that it added enough transactions to the log file that it ran out of space.

Transaction Log Disk Space for Index Operations