Skip to content
Home » Learn » SQL Server Database Engine

SQL Server Database Engine

Incremental Integrity Check for Large Databases

Traditional database integrity checks in SQL Server can be time-consuming and resource-intensive, especially for large databases, even when using super cool tools like Ola Hallengren’s maintenance solution.

To address this challenge, I developed a TSQL script for performing incremental integrity checks, which significantly optimizes the process and reduces its impact on the server.

Read More »Incremental Integrity Check for Large Databases

SQL Server Index Mastery: Choosing the Right Column Order

It’s been a while since my last post about SQL Server performance optimization. This one focuses on index design and how the order of columns in your indexes can make or break your database queries. Using my insights from real-world consulting experience, this guide should help you understand the critical decisions that would impact your database performance.

How does SQL Server decide where to look first when executing a query? The answer lies in the structure of your indexes. Learn how the sequence of key columns can optimize your data retrieval, making your database faster and more responsive.

Read More »SQL Server Index Mastery: Choosing the Right Column Order

Understanding ‘ALTER TABLE SWITCH statement failed’ errors 4907, 4908, and 4912

Recently we’ve encountered an interesting use case for a customer.

They had a table with partitioning that they needed to be archived (with the help of said partitioning), but the ALTER TABLE SWITCH commands were failing with a peculiar error:

Error 4907, ‘ALTER TABLE SWITCH’ statement failed. The table ‘MyDB.dbo.PrtTable1’ has 4 partitions while index ‘IX1’ has 6 partitions.

This prompted some insightful research into some of the validations done by SQL Server behind the scenes when executing an ALTER TABLE SWITCH command.

Read More »Understanding ‘ALTER TABLE SWITCH statement failed’ errors 4907, 4908, and 4912

The Top 15 SQL Server Security Myths

As a SQL Server DBA, you are responsible for securing your organization’s critical data stored in SQL Server. However, there are many myths surrounding SQL Server security 🔒 that can lead to a false sense of security or even leave you vulnerable to attacks. In this blog post, I’ll be debunking the 15 most common security-related myths in SQL Server that every DBA should be aware of. So, grab a cup of coffee, and let’s get started! ☕

Read More »The Top 15 SQL Server Security Myths

Drop All Redundant Indexes In Every Database All At Once

Redundant indexes in SQL Server are a phenomenon that is more common than I’d like to admit. I see it in quite a lot of shops. Meaning, that there’s still a significant target audience for this blog post!

This article published by Brent Ozar is very informative about redundant/duplicate indexes, what they mean, why they’re bad, and what should be done with them.

Also, a few years ago, Guy Glantser published a post about dropping redundant indexes. It’s very useful for finding all redundant indexes within all tables in a specific database.

But what both of these articles are missing – is the ability to easily generate Drop/Disable commands for these redundant indexes.

Read More »Drop All Redundant Indexes In Every Database All At Once