Compatibility levels determine how certain features of SQL Server behave, allowing databases to maintain functionality even as the server itself evolves. However, changing compatibility levels requires careful consideration to balance the benefits of new features against the potential risks of disrupting existing applications. This blog explores the importance of handling compatibility level changes thoughtfully during SQL Server upgrades, highlighting the risks of making changes too hastily and the advantages of adopting new compatibility levels within a reasonable timeframe.
Leveraging SQL Server 2019’s Last Known Actual Query Plan for Troubleshooting
Troubleshooting production performance issues is often challenging because detailed query execution data can vanish before you realize there’s a problem. Many times, you end up piecing together incomplete clues from runtime statistics or the plan cache. Fortunately, SQL Server 2019 introduced a powerful feature to address this pain point: the Last Known Actual Query Plan.
Using sp_getapplock to Prevent Concurrent Execution of Stored Procedures in SQL Server
In multi-user database environments, ensuring the integrity and consistency of data is essential. One common challenge is preventing multiple instances of the same stored procedure from executing at the same time, which can lead to data conflicts, race conditions, and unpredictable results. To address this, SQL Server provides a powerful tool called sp_getapplock. This post explains what sp_getapplock is, what you are actually locking when you use it, how to implement it to prevent concurrent executions of a stored procedure, and the difference between transaction-level and session-level locks.
Understanding Worker Threads vs. CPU Utilization in SQL Server
When managing SQL Server performance, it’s important to understand the relationship—and the distinction—between worker threads and CPU utilization. These are two separate metrics that can behave independently. For instance, you might experience high CPU utilization while still having available worker threads, or you could have all worker threads occupied even when CPU utilization is low. This post takes a look at SQL Server worker threads and CPU utilization.
Exploring Programming Constructs in T-SQL – Part 3: Error Handling and Transaction Management
Welcome back to our series on programming constructs in T-SQL! In the previous installments, we explored variables, conditional IF statements, loops, and CASE expressions. These tools have helped us write dynamic and efficient SQL scripts. In this third part, we’ll focus on two essential concepts for writing reliable SQL code: Error Handling with TRY…CATCH Blocks and Transaction Management.
SQL Server’s Query Store: Understanding Plan Forcing and Performance Optimization
The Query Store in SQL Server is a powerful feature that enables database administrators and developers to track and analyze query performance over time. By storing runtime statistics and execution plans, it provides invaluable insights into how queries behave and how they can be optimized. This blog looks into the mechanics of the Query Store, the necessity of plan forcing, and how to effectively use it to stabilize and enhance query performance.
Building a Career in SQL Server: Tips, Strategies, and Pathways for Aspiring DBAs
Starting a career as a SQL Server Database Administrator (DBA) offers numerous opportunities in today’s data-driven landscape. As organizations increasingly rely on databases to manage and analyze their data, skilled DBAs are in high demand. Whether you’re just beginning or looking to advance in this field, here are some key strategies to help you build a successful career in SQL Server.
Saving Time with SQL Server Migrations Using Always On Availability Groups and Log Shipping
Migrating databases to a newer version of SQL Server is a critical task that often comes with challenges, especially when aiming to minimize downtime. Leveraging SQL Server’s Always On Availability Groups and log shipping features allows you to perform most of the migration work in advance, ensuring a seamless transition with minimal impact on your operations. This blog provides a step-by-step approach to migrating from SQL Server 2017 to SQL Server 2022, focusing on efficiency and continuity.
Determining When to Optimize SQL Server Workloads Versus Upgrading Hardware
When your SQL Server isn’t performing as expected, it’s tempting to think that upgrading hardware is the quick fix. More CPUs, extra memory, faster disks—they all sound like solutions that should solve the problem. But before you start investing in new equipment, it’s worth taking a step back to see if optimization can address the issues.
Understanding SQL Server’s TRUSTWORTHY Database Setting
In SQL Server, the TRUSTWORTHY database setting can grant elevated permissions across a database boundary, influencing how certain modules execute, particularly those using WITH EXECUTE AS or unsafe CLR assemblies. Enabling TRUSTWORTHY allows SQL Server to “trust” that the database owner and associated users won’t misuse elevated permissions to perform unauthorized actions. However, this setting comes with significant security risks if used improperly.