1. Always Encrypted : As the word suggests, ‘Always Encrypted’ feature of SQL 2016 ‘Always’ keeps your sensitive data ‘Encrypted’ either at rest (local environment) or at remote (Cloud/Azure). It will help to protect data from people who may play around it like DBAs, Cloud operators, high-privileged but unauthorised users, again that also has considerations for ad-hoc queries, reporting and exporting the data.
Always Encrypted is designed to protect data at rest or in motion. With Always Encrypted, SQL Server can perform operations on encrypted data and the encryption key can reside with the application. Encryption and decryption of data happens transparently inside the application.
How It Works
You can set Always Encrypted to individual column (where your sensitive data resides). While configuring columns, you need to specify encryption algorithm and cryptographic keys for data protection. There are basically two keys you need to define:
- Encryption Key for column data encryption (It will be used to encrypt data for specific column)
- Master Key: for Encryption of column encryption keys
So basically, it’s a double encryption protection, only program can access it, client application will automatically encrypt and decrypt data before fetching data from database.
2. Enhancements to AlwaysOn : SQL Server 2016 will also continue to advance high availability and disaster recovery with several enhancements to AlwaysOn. The upcoming SQL Server 2016 release will enhance AlwaysOn with the ability to have up to three synchronous replicas. Additionally, it will include DTC (Distributed Transaction Coordinator) support as well as support for round-robin load balancing of the secondaries replicas. There will also be support for automatic failover based on database health.
3. Enhanced In-Memory OLTP : From SQL Server 2014, In-Memory OLTP will continue to mature in SQL Server 2016. Microsoft will enhance In-Memory OLTP by extending the functionality to more applications while also enhancing concurrency. This means they will be expanding the T-SQL surface area, increasing the total amount of memory supported into the terabyte range as well as supporting a greater number of parallel CPUs.
In-Memory OLTP optimally designed for high-speed loading of data with no locking issues or high-volume session state issues. There were a lot of limitations particularly around constraints and procedures. In SQL Server 2016, this feature is vastly improved, supporting foreign keys, check and unique constraints and parallelism. Additionally, tables up to 2TB are now supported (up from 256GB).
Another part of in-memory is column store indexes, which are commonly used in data warehouse workloads. In 2016 it receives some enhancements around sorting and better support with AlwaysOn Availability Groups.
4. Management Studio
- SQL Server Management Studio supports the Active Directory Authentication Library (ADAL) which is under development for connecting to Microsoft Azure. This replaces the certificate-based authentication used in SQL Server 2014 Management Studio.
- SQL Server Management Studio installation requires installing .NET 4.6 as a pre-requisite. .NET 4.6 will be automatically installed by setup when SQL Server Management Studio is installed.
- A new query result grid option supports keeping Carriage Return/Line Feed (newline characters) when copying or saving text from the results grid. Set this from the Tools/Options menu.
- SQL Server Management Tools is no longer installed from the main feature tree.
5. New Default Database Size and Autogrowth Values : New values for the model database and default values for new databases (which are based on model). The initial size of the data and log files is now 8 MB. The default auto-growth of data and log files is now 64 MB.
6. Stretch Database : This would enable your frequently accessed or hot data to stay on-premise and your infrequently accessed cold data to be moved to the cloud. This could enable you to take advantage of low cost Azure store and still have high performance applications.
The basics of Stretch Database are that some part of your tables (configurable or automated) will be moved into an Azure SQL Database in the cloud in a secure fashion.
When you query those tables, the query optimizer knows which rows are on your server and which rows are in Azure, and divides the workload accordingly. The query processing on the Azure rows takes place in Azure so the only latency is for the return of the rows over the network. As an additional enhancement, you are only charged for the SQL Database in Azure when it is used for queries.
So we can say it’s a cost-effective solution for COLD data storage, your data is available anytime for query and manage. You can access your data without changing queries either it is present on local or at stretch database.
To configure it, you need an Azure account and database instance that you need to stretch. The following snap will clear your idea.
7. PolyBase into SQL Server : Microsoft had introduced Polybase, a SQL Server connector to Hadoop (and Azure Blob Storage) to its data warehouse appliance Analytics Platform System in 2015. But now Microsoft has incorporated that functionality into the regular on-premises product. We can connect to all relational and non-relational data from single point, it helps you to connect Hadoop database and Azure Blob storage.
This feature will benefit you if your regular data processing involves dealing with a lot of large text files — they can be stored in Azure Blob Storage or Hadoop, and queried as if they were database tables.
A common scenario where you might use this would be an extract, transform and load (ETL) process, where you were taking a subset of the text file to load into your database. Basically, PolyBase creates a bridge between a data that is outside SQL scope, while querying on Hadoop or Azure storage no additional knowledge or installation is needed. Simply, you can Import and Export data To and From Hadoop or Azure storage. Additionally, you can integrate it with Microsoft’s business intelligence.
8. Native JSON Support : JSON (JavaScript Object Notation) is a standardized data exchange format that is previously not supported natively by SQL Server. To perform JSON imports and exports you need to hand-code complex T-SQL, SQLCLR or JavaScript. SQL Server 2016 incorporated JSON support directly into SQL Server much like XML. SQL Server 2016 will natively parse and store JSON as relational data and will support exporting relational data to JSON.
Several other large databases have added this support in recent years as the trend towards Web APIs using JSON has increased. The way this is implemented in SQL 2016 is very similar to the way XML support is built in with FOR JSON and OPENJSON — providing the ability to quickly move JSON data into tables. SQL has also provided in-built functions for JSON.
SQL has the facility to read JSON format data, load them in table, support index properties in JSON columns.JSON data will be stored in NVARCHAR type. Due to NVARCHAR type, an application has the following benefits:
Already stored JSON data (as text) can be easily migrated on new feature.
As NVARCHAR is supported by all SQL components so is the JSON too.
You can easily fetch data FOR JSON from SQL with the below syntax:
SELECT column, expression, column as alias
FROM table1, table2, table3
FOR JSON [AUTO | PATH]
It is a SELECT command so when we fire the above query, SQL will format each row/cell value and return as JSON object.
9. Query Store : One common issue many organizations face when upgrading versions of SQL Server is changes in the query optimizer, which negatively impacting performance. Without comprehensive testing, this has traditionally been a hard problem to identify and then resolve. The Query Store feature maintains a history of query execution plans
with their performance data, and quickly identifies queries that have gotten slower recently, allowing administrators or developers to force the use of an older, better plan if needed. The Query Store is configured at the individual database level.
Up till now, to check Query plan and execution statistics, we need dynamic management views in SQL but neither will it give you Query plan that executed by past/old queries nor will it store them anywhere so that you can review, but SQL 2016 provides you ‘Query Store’ that takes you through query plan, statistics and Query execution for current and past queries.
To enable it, just right click on database, go to properties. You will see ‘Query store’ at the left corner, select it and click on Enable ‘true’ or you can do it using Query syntax:
ALTER DATABASE [Database1] SET QUERY_STORE = ON
10. Row Level Security : This is again one of the security features of SQL 2016. This restricts which users can view what data in a table, based on a function. SQL Server 2016 introduces this feature, which is very useful in multi-tenant environments where you may want to limit data access based on customer ID. The implementation of RLS in SQL 2016 still has it limits (updates and inserts are not covered). It allows you to secure your data row wise, in short you can define a row, that will be viewed by a particular SQL user only. So depending upon the SQL user access permission, we can restrict row level data.
To implement Row level security, you need to define Security policy with a predicate and function.
Security policy: We need to create a policy for security, here is simple syntax:
CREATE SECURITY POLICY fn_security
ADD [FILTER | BLOCK] PREDICATE FunctionName ON TableName
In the above syntax, FILTER and BLOCK are the predicates that will either FILTER rows and display only those that are available for read or BLOCK rows for write operation.
Function: Function is a simple user defined function, but here are some restrictions for user defined function that are used in Row Level Security
- Database modification operations are not allowed
- OUTPUT INTO clause is not allowed in function
- Multiple result set should not be returned from function
11. Dynamic Data Masking : This is again one of the security features of SQL 2016. It just wraps MASK on your data, in short, it hides your confidential data that you don’t want to display. It just avoids disclosure of your sensitive data. After masking, SQL User with limited rights will not view original text, he can view only Masked Text, SQL has pre-defined masking functions you just need to apply it on different columns
To apply this on specific columns, you just need to ALTER column with ‘MASKED WITH’ function name, see below syntax:
ALTER TABLE tablename ALTER COLUMN columnname MASKED WITH (FUNCTION=‚default()‘)
12.Multiple TempDB : It is always a good practice to have a Multiple Temp data files, if you are working on a big crucial data, up till now (SQL 2014), you need to manually add temp db files to your database but SQL 2016 provides you temp DB configuration settings, in which you can configure Number of TempDB files at the time of SQL installation.
Default number of files are 8 with default size of 64 MB will be given. So you no longer need to configure/create it manually.
13. Temporal Table : When you want to store history of your SQL tables to review your old records after table updation, Then you can go with this features. SQL 2016 provides record version facility in which it keeps a history of changed record and maintains it for timely analysis. This feature can be useful for Audit, checking data trend, accidental update/delete data and many more.
How It Works
Basically, the system keeps pair of a table for history and adds two additional columns in it named ‘SysStartTime’ and ‘SysEndTime’ for start time and end time for row respectively. Live table contains current record of row, whereas history table contains previous record of row. We can fetch data from History table, with the
following query syntax:
SELECT * FROM table1 FOR SYSTEM_TIME
BETWEEN date1 AND date2
WHERE condition;
14. Revamped SQL Server Data Tools : Another change in SQL Server 2016 is the reconsolidation of SQL Server Data Tools (SSDT). As Microsoft worked to replace Business Development Studio (BIDS) with SQL Server Data Tools they wound up confusing almost everyone by creating not one but two versions of SQL Server Data Tools both of which needed to be downloaded separately from installing SQL Server itself. With the SQL Server 2016 release Microsoft has indicated that they intend to reconsolidate SQL Server Data Tools.
15. Real-time Operational Analytics : This feature uses the dynamic duo of SQL Server’s in-memory technologies; it combines In-Memory OLTP with the in-memory columnstore for real-time operational analytics. Its purpose is to tune your system for optimal transactional performance as well as increase workload concurrency. This sounds like a great combination and applying analytics to your system’s performance is something a lot of customers have asked for a long time but you will certainly need to have the memory to take advantage of it.
16. R Introduction : Have you stored statistical data in SQL? Want to use R to analyze it? You export data each time from SQL to R? Then your headache will now be covered in SQL 2016, because it is now with R. You can run R script on SQL. You need to install this feature at the time of SQL setup.