Hi Friends,

Various new features and improvements are coming with SQL Server 2016. Various performance improvements are also added to the CTP versions. Today, I’ll show you one of them i.e. Alter Table … Alter Column online operation.

Blocking is one of the major problems when you work on performance tuning for SQL Server. We knows that when we perform any schema modification like Alter table … Alter column operation then it will take SCH_M lock and we found blocking for our select queries over that table. Generally these operations perform during scheduled time window. Let me show you that how this new feature can improve the performance. Here I am using CTP 3.3 and AdventureWorks2014 database for testing.

First let me create a copy of SalesOrderDetail table and insert some data into that:

Now Run below code into one session (for me session id is 55)

Now try to execute below code in another session (for me session id is 57)

You can see the session details by using below query in new query window.


From the above output you can see that my Select query (session id 57) is blocked by Alter Column query (session id 55). After completion of above operations, Now let me add ONLINE=ON to my Alter column session as mention below:

Now again execute the alter query first and then execute the select query in parallel. Now again check the session details using below query:


This time SQL Server decides to go with parallelism but notice that there is no blocking between both the sessions 55 and 57.

Some limitations are also there for Alter Column Online operation, you can check them here.

Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook