In my previous post, I touched upon SQL Server wait types and in order to understand wait types in SQL Server, it's important to know first how the server schedules tasks. On each CPU core, only a single thread or "worker" can be running at any given time. Each CPU, be it logical or physical inside your SQL Server is assigned a scheduler and it is responsible for managing t … [Read more...] about An Overview of SQL Server Task Scheduling
An Introduction to SQL Server Wait Types and Stats
Ok, so in this post, I wanted to go over SQL Server wait types and statistics - what they are and how to check them. My idea is then to start a series of posts which go into more detail about individual SQL Server wait types, their causes and how to improve them. At the time of writing this post, I do not know about all of the wait types in SQL Server and there are many of … [Read more...] about An Introduction to SQL Server Wait Types and Stats
How to Delete Millions of Rows using T-SQL with Reduced Impact
In this post, I talk about deleting millions of rows in SQL Server whilst keeping impact low. Deleting millions of rows in one transaction can throttle a SQL Server TRUNCATE TABLE - We will presume that in this example TRUNCATE TABLE is not available due to permissions, that foreign keys prevent this operation from being executed or that this operation is unsuitable for … [Read more...] about How to Delete Millions of Rows using T-SQL with Reduced Impact
Reset Table Identity Value Using DBCC CHECKIDENT RESEED
DBCC CHECKINDENT RESEED can be used to reset a tables identity value on a column. On the official Microsoft page about it, it reads "Checks the current identity value for the specified table in SQL Server 2016 and, if it is needed, changes the identity value. You can also use DBCC CHECKIDENT to manually set a new current identity value for the identity column." This … [Read more...] about Reset Table Identity Value Using DBCC CHECKIDENT RESEED
Using sp_change_users_login to fix SQL Server orphaned users
In this post, I'm going to be looking at sp_change_users_login in order to fix SQL Server orphaned users as a continuation to a previous article. There I looked at a couple of ways to transfer logins from one SQL Server to another and touched upon the issue of the orphaned "security identifier" (SID). A typical scenario that arises is when the DBA quickly realises that the lo … [Read more...] about Using sp_change_users_login to fix SQL Server orphaned users