Monday, April 24, 2017
Use the below statement to get all SQL Server internal task details.
SELECT * FROM sys.dm_exec_sessions
The below statement too seems correct but it does not give all the internal tasks.
SELECT * FROM sys.dm_exec_requests
Wednesday, April 19, 2017
AI Into SQL Server 2017
Today (4/19/2017), Microsoft announced the release of SQL Server 2017 CTP 2.0 (formerly known as SQL Server vNext). It has pretty exciting features including deep learning AI capabilities. Deep learning model demonstrated today at Microsoft Data Amp is used some medical data to figure out the probability of getting a lung cancer for a particular patient. Faster early detection of such potential disease helps to reduce the healthcare cost and also to have a healthier life. All these happens under one roof meaning, in one single data platform which is SQL Server. All the analytics capabilities of the deep learning system are now integrated into SQL Server which makes super easy for data scientists to work and analyze data. The application has to call just a single stored procedure to do the deep learning analytics of a patient, it's that much simple.
The data, the model, and the intelligence are all built into SQL Server which will eliminate so many challenges of building today’s AI application by using so many different types of tools.
SQL Server 2017 has a built-in support for Python code inside T-SQL queries which gives so much powerful programming capabilities. SQL Server 2016 supported R integration as well. You can use sp_execute_external_script system stored procedure with T-SQL to call R or Python language which external to T-SQL.
Adaptive Query Processing
Adaptive Query Processing is one of the extremely powerful database engine enhancements in SQL Server 2017. With this new feature SQL Server has the intelligent to learn itself about query processing and improve itself and generate better execution plan based on past query execution with no human intervention. This is an amazing feature that I was dreamed for years.
Graph data represents many-to-many relationships and typically relational databases need to store that kind of relationships as one-to-many relationships. SQL Server now supports graph data and processing of graph data. You can create graph objects which create nodes and edges in SQL Server 2017. This essentially extends the SQL Server query processing capabilities. This query capability is fully integrated into SQL engine in SQL Server 2017. Previously, you had to use a special type of databases called graph databases to store this kind of data.
One platform which supports both Windows and Linux
All the features of SQL Server 2017 now support both Windows and Linux platforms.
In a nutshell, SQL Server is not just another database server, it is an extremely powerful data platform eco-system because it combines AI and analytics into one product. Everything is built in. So much easier than using hundreds of different tools. I can’t wait to get some hands-on of these new features.
Wednesday, April 12, 2017
In-Memory OLTP, code named Hakaton is a separate database engine introduced in SQL Server 2014 and it is combined with SQL Server traditional database engine. So when you install SQL Server, you will get both database engines. Modern computers/servers are getting more physical memory (RAM). Windows Server 2016 support 24 TB of physical memory. So it is clear the future is more towards In-Memory databases regardless of database type.
I’d recommend reading Microsoft published whitepaper by Kalen Delaney on In-Memory OLTP. here
In-Memory OLTP simply means you can create memory optimized tables as well as natively compiled stored procedure. In other words, you can store the schema of the entire table and data in memory. However, it obviously has some limitations too. Those limitations will be addressed in every new release of SQL Server.
It is possible to migrate the tables and other objects in existing databases to memory-optimized structures. Since it has limitations, the first step would be to identify the list of objects which are eligible for the migration. The SSMS (SQL Server Management Studio) provides a feature (wizard) that you can use for this purpose. The below steps will go through the details of the wizard against the sample database, AdventureworksDW2016CTP3 which you can download and install.
Follow the below steps to generate the checklist.
- Connect to the server in SSMS.
- Right-click on the database and select Generate In-Memory OLTP Migration Checklist option. (See below screenshot)
- Click Next on the first page of the wizard.
- In Choose Objects screen, you can select the tables, stored procedures or both. You also can specify a location for the checklist to be saved. Then click on Next. (See below screenshot)
- In Summary page, you can generate the PowerShell script for this task. This is optional. Click on Finish.
- It takes some time depending on the number of objects (tables, triggers, foreign keys, indexes, stored procedures, etc) in the database. Because it checks all the dependent objects against the In-Memory OLTP rules.
You can view the checklist generated by the Advisor in the location you specified in step #4.
It creates the subfolders under database name folder for each object. See below screenshot.
The contents of each folder look like below. Below screenshot displays the checklist for stored procedures.
Open each HTML file to see the details of the analysis.
I will write another blog post on how to analyze the checklist information.
Monday, April 10, 2017
Sharding is a data partitioning technique which is popular in NoSQL databases like MongoDB and Cassandra. You can scale out the data set horizontally using sharding. SQL Server does not support sharding natively, however, you can implement sharding solution in SQL Server from application end. Below article describes sharding patterns that you can implement with SQL Server databases.
Sunday, April 9, 2017
The latest release of Microsoft Windows Serve version is Windows Server 2016. The most salient feature of the Windows Server 2016 is the maximum server memory support. The maximum memory supported by Windows Server 2016 is 24 TB. Yes, it's terabytes. This is amazing. If you're running SQL Server 2014 or 2016, you can keep terabytes size databases completely in memory by using In-Memory OLTP technology. Windows Server 2016 is only available with x64 address space. The memory support limit is a huge gap from Windows Server 2012 which supports the maximum physical memory of 4 TB. Tt is no doubt that future of relational databases is based on In-Memory OLTP technology rather than traditional storage based technology. So it's time to get the skills set ready and spend more time with In-Memory OLTP.
More details: Memory Limits of Windows and Windows Server Release
Thursday, March 30, 2017
Both SQL Server 2016 and vNext versions have introduced many new features. T-SQL language too gets new features in each SQL Serer versions. Below two enhancements to T-SQL language is very important for DBAs and Database Developers who writes T-SQL heavily.
- CREATE OR ALTER
You can create SQL Server objects like below by using CREATE OR ALTER statement.
CREATE OR ALTER PROC dbo.TestProc
This way, you can create or alter stored procedure, function, view, and trigger. However, this does not apply for table object. This saves developers time tremendously because it avoids numerous validation steps.
- DROP IF EXISTS
The new DROP EXISTS statements also avoids some conditional logic that you need to include to check the existence of the object before it drops.
DROP PROC IF EXISTS dbo.TestProc
This statement works with many SQL Server objects. See the below figure;
So if you’ve SQL Server 2016 or vNext in your environments, you can start using these new features right away.
My latest article. http://bit.ly/2qd4rtl Understanding Skewed Data in SQL Server bit.ly Introduction I re...
I wanted build an expression to make a folder name dynamically. (Basically expressions are anyway dynamic in nature) So I simply used the ...
OSTRESS is a Microsoft tool comes with RML utilities package and it uses to stress SQL Server. This is especially useful when you want to tr...
When querying sys.dm_exec_requests dmv, you can see the waiting requests and the resource those requests are waiting for. Sample of such val...