Monthly Archives: August 2018

MAX DOP calculator

Every time I conduct a SQL Server health check, it’s pretty common for me to find wrong configurations at instance level. But one of the most common mistakes I see on the wild, is SQL instances having the “max degree of parallelism” (MAXDOP) set to “1” (single core) , probably this behavior is related to a misconception of how parallelism works or because some DBAs thinks this parameter reduces the “CXPACKET” wait types, who knows …

In order configure MAXDOP properly, DBA’s should read and understand what Microsoft’s has as best practice guideline in the KB# 2806535. This article has a table with the explanation on how to calculate the right value for this configuration:

If you are not familiar with NUMA nodes, logical CPUs or CPUs at all this can be a little bit confusing …

NUMA nodes, CPU specs, logical CPU’s, wait …. WHAT???

I understand, we live in a very busy world where we need to do things quick and make everyone’s work easier. Just imagine having to make this calculation every time you want to change the MAXDOP configuration, you truly need something to make your life easier… enter MAXDOP calculator.

The concept of a MAXDOP calculator was created by a Microsoft field engineer long time ago, the article helps you to set the right value for the MAXDOP configuration, the problem I noticed with this tool is that requires a lot of manual intervention. Anytime you would need some help calculating the correct MAXDOP value you will have to visit the website and provide the input from a couple of queries, there is also an Excel version but I do see the same problem. Don’t get me wrong I think this is a wonderful idea but I do personally don’t like manual stuff.

Based on this need, I have created the same calculator but this time in T-SQL. The same concept but in runs in a SQL environment directly, returning the correct MAXDOP value without using any input as the original approach.

Here is an example of the output:

MAXDOP recommendation at Instance level for also T-SQL statement suggestion to re-configure value

At you can see, it provides you the current and recommended MAXDOP configuration also including the syntax to change it in case it is wrong. For SQL Server 2016 or major, it also returns the MAXDOP value configured at database level.

MAXDOP recommendation at DB and Instance level for SQL Server 2016 (and major) also T-SQL statement suggestion to re-configure MAXDOP

If you want to give try it, you can download the T-SQL script from my GitHub repository.

The requirement to execute this T-SQL script is to have SQLCMD mode enabled in SSMS, you can take a look at my previous post to learn how to enable it.

Please feel free to provide me feedback about this tool, stay tuned for more DBA mastery tips!

Guatemala SQL Server local group

Good news for all the Guatemalan data professionals, starting from August 2018 you have an official PASS SQL Server local group near to you!

What is PASS?
First thing first, for all those future members of this local group I will like to explain what is the PASS organization all about.

PASS is the world’s largest community for Microsoft Data Platform users to connect, share and learn with fellow data professionals. Join PASS today for free. it is s a not-for-profit organization run by and for the community that supports data professionals throughout the world who use the Microsoft data platform.

Why a SQL Server group in Guatemala?
Microsoft has been doing a great lately releasing new features and tools for SQL Server, the need of the creation of a new PASS group born when I noticed that there was only one PASS group for Guatemala but it was dedicated for BI (Business Intelligence) stuff, I know it’s difficult to keep up with technology (it goes really fast) but at the same time is important at least to stay updated and if you have time why not? to get exposure to new experiences … a really good way to achieve this is through a professional community giving opportunity to people to share their knowledge and experiences to benefit others. So, that’s one of the main reasons I decided to get in touch with PASS and get the approval to create a new group specifically for SQL Server.

This is a great opportunity for all the Guatemala data professionals to share their knowledge, experiences, get exposure to new SQL Server technologies through free training and the most important to get in touch with colleagues that are doing the same kind of job as you.

Meet the crew:
I, Carlos Robles (@dbamastery) was designated as the Group leader, so I’m charge to get in touch with the PASS organization for any matter related to this group. Of course this is not a one person effort, in order to make a great group community we have to have a great team.

I will have the collaboration of Christian Araujo (@charaujo), Carlos Lopez (@MuppetRocks) and Eduardo Pivaral (@EduardoDBA) as group admins who will be actively participating in all the activities planned for this group.

Please, don’t hesitate to get in touch with me or anybody else from board members we will be more than happy to answer any of your questions. In case you wondering who we are, you can learn a little bit more about our experience working with SQL Server here.

When, where and how?
The dynamic of this group is quite simple, we will meet the last Thursday of every month at 18:00 PM, of course this schedule is always subject to change in case there is a national holiday or any other major event \ activity going on that could cause difficulties to the attendees to assist.

We will be hosting these meetings in ATOS Guatemala (3rd floor), here is the exact location:

Paseo Cayalá Oficina 301, Edificio H 3er nivel, Distrito Moda Zona 16

To assist these meetings, the requirement is to be register in the official PASS website of Guatemala SQL Server local group. Don’t forget to carry on a photo ID, you will have to present it at the building lobby to complete the check-in process to get you access to the ATOS Guatemala facilities (3rd floor).

What we will be talking about?
Anything related to SQL Server technologies, like upcoming features, known issues, best practices, tips and tricks, tools and more. We encourage members to participate as speakers and share their knowledge and experience with the local group.

Remember, this is your community the sessions won’t be limited to the topics chosen by the board members … we would appreciate hearing your thoughts on this as proposition topics that you would like to learn\discuss about.

Spread the news!!
The more members the better, this group is organized to bring professionals of all career levels that work with Microsoft’s SQL Server, together to learn and network with others. There is no charge to attend and you are encouraged to bring your co-workers\friends.

So, please go ahead and make yourself part of this new SQL Server community here created specially for all the data professionals in Guatemala!!!!

Don’t forget to follow us on twitter and facebook to stay up to day with all the local group activities.

Cleaning up Query Store data after database restore

Query Store is a very powerful tool for performance tuning, if you are not using it already you should!! It will save you a lot of time and effort because it makes the performance troubleshooting easy for DBA’s. It helps you to quickly find performance differences caused by query plan change or a query regression after an upgrade.

One of the caveats of using this tool is that uses space from the PRIMARY file group when enabled, that means if the database is restored to another environment the Query Store data will be restored as well making your database restored version a little bit bigger and containing information that is probably not relevant for a development environment (unless you are doing a troubleshooting).

In case you have recurrent tasks to restore a production database in a different environment and you are not interested on having the Query Store data on your restored version, there is a way to cleanup the Query Store data for good.

Here is the T-SQL script you have to use:


As you can see, with this simple T-SQL script you are not only cleaning up all the Query Store data but also disabling Query Store putting it in read only mode.

Stay tuned for more DBA mastery tips!