Simplify data access using de-normalized models

Classic relational databases enable you to create highly normalized data models with schema that might contain a lot of tables. Logical entities are broken into several tables and every complex property of the primary entity (for example, list, array, collection) is placed into separate table. An example of simple Person entity that has many email… Read more

Working with Azure IoT data in Azure SQL Database

IoT use cases commonly share some patterns in how they ingest, process, and store data. First, these systems need to ingest bursts of data from device sensors of various locales. Next, these systems process and analyze streaming data to derive real-time insights. The data is stored in some persistent storage for further analysis. In the… Read more

Compatibility Level 140 is now the default for Azure SQL Database

Database compatibility level 140 is now the default for new databases created in Azure SQL Database across almost all public regions.    As of this writing, there are already 539,903 databases in Azure SQL Database running in compatibility level 140. Questions related to this announcement: Why move to database compatibility level 140? The biggest change is… Read more

Database scoped optimizing for ad hoc workloads

SQL Server provides the “optimize for ad hoc workloads” server-scoped option that is used to reduce the memory footprint of single use ad hoc batches and associated plans.  When enabled at the SQL Server instance scope, the “optimize for ad hoc workloads” option stores a reduced-memory compiled plan stub on the first execution of an… Read more

Injecting JSON objects into existing JSON text with JSON_MODIFY function

JSON_MODIFY function that is available in SQL Server 2016+ enables you to modify existing text formatted as JSON and add or update existing values. One common problem that happens is inserting unexpected value while trying to update existing JSON text and inject JSON object in the text. In this post I will show you one… Read more

Transitive closure clustering with CLR and JSON

Transitive closure is a graph algorithm that tries to follow paths in graph edges and tries to find all elements that can be reached from some element, or groups of elements that are mutually reachable. Although SQL Server still don’t provides native function for transitive closure, this algorithm can be implemented using CLR aggregates that can… Read more

Storing JSON documents in SQL Database

SQL Server and Azure SQL Database have native JSON functions that enable you to parse JSON documents using standard SQL language. Now you are able to store JSON documents in SQL Database and query JSON data like in any NoSQL database. In this post we will see what are the options for storing JSON documents in… Read more

Building SQL REST API back-end for Angular apps

JSON support in SQL Server/Azure SQL is designed to make integration between the relational database models and the modern single-page JavaScript apps easier than ever. SQL Server/Azure SQL enables you to easily format results of SQL queries as JSON text and return it to your JavaScript apps. In this post you will see how easily… Read more

ASP.NET Session State with SQL Server In-Memory OLTP

ASP.NET session state enables you to store and retrieve values for a user as the user navigates the different ASP.NET pages that make up a Web application. Currently, ASP.NET ships with three session state providers that provide the interface between Microsoft ASP.NET’s session state module and session state data sources: InProcSessionStateStore, which stores session state… Read more

JSON vs CLR UDT – performance comparison

Ability to create custom user defined types in CLR and use them in SQL Server is introduced in SQL Server 2005. In SQL Server 2016 is added JSON support that might be alternative for storing complex objects. Since JSON is stored as NVARCHAR and CLR is a type, it is questionable what would be better… Read more