Welcome to Part 4 of our ongoing series on T-SQL programming constructs. So far, we’ve discussed variables, conditional IF statements, loops, CASE expressions, and covered essential concepts like error handling and transaction management. Now, we turn to Common Table Expressions (CTEs)—a powerful feature in T-SQL that can simplify complex queries and enable recursion.
How to Set Up a SQL Server Always On Environment Using Docker Containers
Deploy a high availability SQL Server Always On environment using Docker containers. This step-by-step guide covers Dockerfile configuration, Docker Compose orchestration, and T-SQL scripts for enterprise DBAs and BI developers to ensure seamless CDC and database performance.
Understanding and Managing the Model, MSDB, and Master Databases in SQL Server
It’s easy to focus on user databases and overlook the system databases at the core of every SQL Server instance. However, the master, msdb, and model databases form the backbone of your environment. Understanding each database’s specific responsibilities, how to safely customize them, and how to protect them from data loss or corruption is important for maintaining a stable server. In this post we take a look at all three databases to better understand their purposes and proper maintenance.
Natively Compiled Stored Procedures with in-memory OLTP in SQL Server
Modern applications often demand lightning-fast performance from their databases, whether they’re handling large transactional workloads or complex analytical queries. SQL Server’s in-memory OLTP feature addresses these needs by using memory-optimized tables and natively compiled stored procedures to boost throughput and reduce latency. This post provides an overview of natively compiled stored procedures, how to create them, and best practices for performance monitoring and maintenance.
Comparative Analysis: SQL Server on Linux vs. Windows for Production
For years, SQL Server was synonymous with the Windows operating system, a pairing that brought deep integration and mature ecosystem support. The arrival of SQL Server on Linux introduced a broader choice, allowing organizations to deploy Microsoft’s flagship relational database on an entirely different platform. Although both versions share the same core engine, technical differences persist in the way each handles process scheduling, I/O, security, and administration.
SQL Server 2019 and the Memory Grant
When SQL Server runs a query, it needs memory for operations like sorting and joining data. It also relies on memory during query compilation to hold intermediate plans while the Query Optimizer finds the best execution strategy. In parallel processing scenarios, the memory requirement grows even further. SQL Server manages this by pre-allocating memory for each query through the SQL Server Operating System (SQLOS). This process ensures that no single query can monopolize the server’s memory
Exploring Spinlocks and Latch Contention in SQL Server
High concurrency can expose subtle performance bottlenecks in SQL Server, particularly those stemming from spinlocks and latch contention. Both mechanisms exist to synchronize access to shared data structures, yet they operate differently and require distinct troubleshooting approaches. By recognizing how they work and knowing what causes them to overload a system, DBAs can reduce CPU spikes, timeouts, and overall application slowdowns.
Five Helpful Queries for SQL Server DBAs
As a SQL Server DBA, having the right set of queries can significantly streamline your workflow, enhance monitoring, and aid in troubleshooting. This post shares five essential queries that address common administrative tasks, each accompanied by a detailed explanation to help you understand their purpose, interpret the results, and take appropriate action.
SQL Server Always On Health Check and Lease Timeout Monitoring
SQL Server Always On Availability Groups are a robust solution for achieving high availability and disaster recovery for SQL Server databases. However, simply configuring them is not enough—you also need a solid monitoring strategy to ensure data integrity and system reliability. One key aspect of this monitoring process is keeping an eye on lease timeouts, which can signal larger issues and help prevent potentially catastrophic split-brain scenarios. In this post, we’ll walk through the various health checks available for Always On Availability Groups, discuss how lease timeouts work, and explore practical methods for monitoring and troubleshooting.
Reading SQL Server’s XML Deadlock Report Captured by the system_health Event
SQL Server includes an Extended Events session called system_health, which runs by default and, among other things, captures information about deadlocks as they occur. When two or more sessions block each other in such a way that no progress can be made (a deadlock), SQL Server chooses one session as the “victim,” rolls back its transaction, and frees resources so other sessions can continue. By reviewing the deadlock report in the system_health session’s XML output, you can see precisely why the deadlock happened and identify which queries or procedures were involved.