Skip to content

TempDB – Do This and Don’t Do That

Today I am presenting my “TempDB – Do This and Don’t Do That” session at SQL Saturday Redmond.

Here is the download of the presentation and samples.

StedmanTempDbPresentation.zip

 

Some of the sample code from the session:

DECLARE @logInfoResults AS TABLE
(
[RecoveryUnitId] BIGINT, -- only on SQL Server 2012 and newer
[FileId] TINYINT,
[FileSize] BIGINT,
[StartOffset] BIGINT,
[FSeqNo] INTEGER,
[Status] TINYINT,
[Parity] TINYINT,
[CreateLSN] BIGINT
);

INSERT INTO @logInfoResults
EXEC sp_executesql N'DBCC LOGINFO WITH NO_INFOMSGS';
--SELECT AVG(FileSize) / 1024.0 / 1024.0 as AvgSizeMB, count(*) as VLFs FROM @logInfoResults ;
--SELECT FileSize / 1024 / 1024, [Status] FROM @logInfoResults ;
SELECT * FROM @logInfoResults ;

SELECT ISNULL(cast([Status] as nvarchar(10)), 'Total'),
COUNT(*)
FROM @logInfoResults
GROUP BY [Status] WITH ROLLUP;

 

I hope you enjoy the session.


More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *