SQL Geek
Finding Untrusted Foreign Keys and Constraints
In the previous blog, we discussed the Foreign Keys Constraints and how the CHECK Constraints are useful to verify the data that goes into your tables. But, sometimes when you need to load a lot of data quickly, SQL Server allows you to temporarily disable any CHECK or FOREIGN KEY… Read more
0 comments, 106 reads
Posted in SQL Geek on 19 April 2018
Find Missing Indexes For All SQL Server Databases
DMV (Database Management View) and DMO (Database Management Objects) were added in 2005. There have been huge improvements in each new edition of SQL Server. It provides us a lot of useful information about SQL Server like – expensive queries, wait type, missing index…., and the list goes on and… Read more
0 comments, 191 reads
Posted in SQL Geek on 16 April 2018
SQL Server Logical Query Processing
Recently, while reviewing one of the stored procedure performance, I suggested a couple of changes to a developer to improve the performance of the SP. One of the suggestions was to replace DISTINCT with GROUP BY.
A few days later, he came back to me with a performance matrix to… Read more
0 comments, 718 reads
Posted in SQL Geek on 12 April 2018
How to Check SQL Server View Utilization
If you are working on SQL Server optimization delicately, you may get often queries that how to find if any index, table or view is being used in database or not.
In recent past, we went live for one of the critical application. The developers decided to check through all… Read more
0 comments, 600 reads
Posted in SQL Geek on 9 April 2018
What is a Foreign Key & How many foreign keys can you have on a single table?
Yesterday, I was attending a database design meeting. In the meeting, I was asked one of the questions – “How many foreign keys can you have on a single table?” Honestly, I had no clue about the limit. But, I must acknowledge that it was an excellent question… Read more
2 comments, 2,568 reads
Posted in SQL Geek on 5 April 2018
How SQL Compilation Can Prove the Server CPU
It is relatively easy to spot CPU-bound system. But, the source of CPU pressure is not always easy to pinpoint. The CPU can be driven by many factors on the server such as;
- Memory pressure which is causing SQL Server to continually move data in and out of the memory.
4 comments, 178 reads
Posted in SQL Geek on 2 April 2018
SQL Performance – Using Query Hint OPTION (FAST N)
It is fun working with SQL/Application developer where you exchange a lot of technical thoughts to find the root of the issues. Recently, one of the developers optimized the OLTP system stored procedure by putting the query hint OPTION (FAST ‘N’). But, he was not sure enough about… Read more
2 comments, 684 reads
Posted in SQL Geek on 21 March 2018
New Built-in Function CONCAT_WS() – SQL Server 2017
In my previous post on new functions in SQL Server 2017, I discussed about the STRING_AGG function. Here, I am going to discuss about the function CONCAT_WS.
This function concatenates a variable number of arguments with a delimiter specified in the first argument.
Syntax for the function
CONCAT_WS ( separator,…
0 comments, 1,195 reads
Posted in SQL Geek on 2 March 2018
Set New Errorlog File location – SQL Server on Linux
For SQL Server 2017 RTM, the fourth cumulative update was released on 20th February, and it is available for download at the Microsoft Downloads site. It brought a couple of significant improvements like;
- Set new errorlogfile location
- Change the location of master database file on existing SQL installation
- Change…
0 comments, 1,314 reads
Posted in SQL Geek on 1 March 2018
New Built-in Function STRING_AGG() – SQL Server 2017
SQL Server 2017 introduces a set of useful functions like STRING_AGG(), STRING_SPLIT(), TRIM()… and many more. In this tip, I am going to discuss one of the built-in aggregate functions – “STRING_AGG()”.
The function concatenates values from rows as one value with a separator, and the main advantage is it… Read more
0 comments, 1,061 reads
Posted in SQL Geek on 28 February 2018
Who installed SQL Server?
Recently, I was working with the team and got stuck up with SQL Server Installation information. We got an urgent requirement to patch the physical box from Windows team.
As the server was not in production, so the server entry was missing. Since Windows team wanted to take action on… Read more
2 comments, 933 reads
Posted in SQL Geek on 27 February 2018
Change the name of master database files – SQL Server on Linux
In my recent blog, I discussed about how to move master database to another location. One of the readers requested to blog about renaming the master database files. So, we are going to explore step by step process of renaming the files in this blog.
Change the name of…
0 comments, 563 reads
Posted in SQL Geek on 26 February 2018
How to Move Master Database to Another Location – SQL Server On Linux
With the release of SQL Server 2017 CU4, you can use the mssql-conf utility to move the master database file to another location. By default, master database is located at the location /var/opt/mssql/data. Now, if you want to change the location of master database file to a different location,… Read more
0 comments, 1,468 reads
Posted in SQL Geek on 23 February 2018
Capture SQL Server Reported Errors using Extended Events
In my introduction to Extended Events blog, I mentioned that the xEvent is my favorite toy for performance troubleshooting. This blog may make you to start playing with it. In this tip, I will be discussing how you can find what caused SQL Server to write error in the… Read more
0 comments, 2,300 reads
Posted in SQL Geek on 20 February 2018
Extended Event Packages
I continue blogging on extended events. Today, I will discuss about the top level containers (Package) that gives access to one or more smaller items inside of extended Events
Extended Event Packages Definition
In the Extended Events Engine, Packages are registered inside the modules and contain the information about what… Read more
0 comments, 39 reads
Posted in SQL Geek on 25 January 2018
Mapping SQL Trace to Extended Events
Since I started actively participating in SQL community, I found it is very common that people will approach to seek help on their SQL related issues. I do love to help people because it is always a win and win situation for both of us.
Recently, I had a phone… Read more
0 comments, 350 reads
Posted in SQL Geek on 19 December 2017
Reset SA password on SQL Server on Linux
This article is about how to proceed when you forgot the password of your SQL Server “sa” account, Password was entered wrong many times then “sa” account got locked, or someone wants to reset the password without using SQL Server management studio (GUI).
The mssql-conf is a configuration tool that… Read more
2 comments, 1,192 reads
Posted in SQL Geek on 11 December 2017
How to Get Estimated Completion Time of SQL Server Database Backup OR Restore
“How much time SQL Server is going to take to complete the database Backup or Restore” – This is one of the very common questions DBAs face in day to day life when they are performing database refresh activity, database migration activity, or any adhoc activity where DBA may want… Read more
7 comments, 3,173 reads
Posted in SQL Geek on 9 December 2017
Introduction to Extended Events
Since I started playing with Extended Events, it has been my favorite toy for performance troubleshooting. It was introduced in SQL Server 2008, and it provides a very rich method of collecting diagnostic data from SQL Server. You can get in-depth detailed information using extend event for troubleshooting which was… Read more
0 comments, 288 reads
Posted in SQL Geek on 29 November 2017
SQL SERVER ON LINUX INSTALLATION – PART4 – INSTALL SQL SERVER AGENT ON RHEL
In my previous tips, I explained about install RHEL Server on the virtual machine, install SQL Server 2017 on Red Hat Enterprise Linux, and Install SQL Server Command-Line Tools on RHEL. In this tip, I will explain how to install SQL Server Agent on a Linux server,… Read more
0 comments, 313 reads
Posted in SQL Geek on 25 November 2017