Categories
SQL Server

Multithreaded Concurrency Essentials

Recently we looked at single threaded concurrency in SQL Server for workloads which only need a single core to execute. We saw how they ran at the same time with the queries effectively being round-robined on the CPU. This time out I wanted to look at how the concurrency looks when we’re working with multithreaded workloads. Setting […]

Categories
SQL Server

Demonstrating Concurrency in SQL Server

The question for today: if we have three queries – one which takes 1 second to run, one which takes 2 seconds to run, and one which takes 3 seconds to run – how long will it take to return data for the first and last query if they all start at the same time? […]

Categories
SQL Server

SSMS Productivity Boost with Multi Line Editing

One of the most time consuming tasks in Management Studio is repeating the same changes across multiple lines of a query. The answer to this? – Multi Line (or Column Mode) Editing. Here’s a quick post to explain what it is, how to do it, and examples to see it in action. What is multi […]

Categories
SQL Server

Object Visibility: Who Can See What

When developing database solutions we’ll typically spend some time considering security requirements, which will result (in part) with database roles being assigned to users or groups of users. Whilst security considerations will likely be focused on what folks can do in our databases, there’s a separate impact on what they can see in them too. I’ve had more than […]

Categories
SQL Server

Persisting Data Following Rollback

We recently looked at the impact of rolling back transactions on statistics and I thought it would be worth following this up to look at some other objects to see how they behave when a rollback occurs. When rolling back transactions we expect any changes to be rolled back. This isn’t always the case with data, just […]

Categories
SQL Server

Impact on Statistics of Rolling Back Transactions

I recently saw an Office Hours (at sea) Q&A from Brent where he was asked if statistics were rolled back along with a transaction. It’s a great question which I’d never come across so thought it would be worth looking into. TL;DR: They aren’t, but they may need to be updated when the data is next queried. […]

Categories
SQL Server

Modifying Data in Multi Table Views

Last time out we looked at modifying data in a view, but this only worked when we had a view referencing a single table. Here we’ll look at how we can achieve the same result for a view which references multiple tables. This one will require a little more work for us in the form of some extra […]

Categories
SQL Server

Modifying Data in a View

A view can be created in SQL Server to allow data to be presented in a specific way for a particular user or use case which may need to consume it. Recently I came upon a feature which I hadn’t been aware of throughout my career around SQL Server – you can perform data modifications […]

Categories
SQL Server

Auditing Schema Changes with DDL Triggers

A couple of weeks back we looked at how to implement DDL triggers in a database and briefly created a couple as examples. This time we’ll put that into use with a particular purpose: to audit modifications to our database schema. Storing the audit Before we get to the trigger we want to create a table to […]

Categories
SQL Server

Implementing DML Triggers

Last time out we looked at implementing DDL triggers in SQL Server and today we’re going to look at the other commonly used trigger – DML. What are DML triggers DML triggers are used to react to events caused by data manipulation language (DML) statements. These events are targeted to a specific table or view and so […]