SlideShare a Scribd company logo
DBAs vs Developers:
JSON in SQL Server
| Bert Wagner | September 30, 2017
1
DBAs vs Developers: JSON in SQL Server
Background
• BI developer @ Progressive Insurance for 6+ years
• I ❤ JSON – I use it in APIs, hardware projects, websites
• I also ❤ SQL – relational database structures
3
Overview
• What is JSON?
• Why use JSON?
• When is it appropriate to store JSON in SQL?
• Usage examples:
• ETL and reporting
• Database object maintenance
• Performance parsing
• Performance comparisons
4
5
What does JSON look like?
{
“Make” : “Volkswagen”,
“Year” : 2003,
“Model” : {
“Base” : “Golf”,
“Trim” : “GL”
},
“Colors” : [“White”, “Pearl”, “Rust”],
“PurchaseDate” : “2006-10-05T00:00:00.000Z”
}
6
Why use JSON?
Easy Processing
var car = { "Make" : "Volkswagen" };
console.log(car.Make);
// Output: Volkswagen
car.Year = 2003;
console.log(car);
// Output: { "Make" : "Volkswagen", "Year" : 2003" }
Javascript:
7
Why use JSON?
APIs
8
Why use JSON?
Storage Size
<Car>
<Make>Volkswagen</Make>
<Year>2003</Year>
<Model>
<Base>Golf</Base>
<Trim>GL</Trim>
</Model>
<Colors>
<Color>White</Color>
<Color>Pearl</Color>
<Color>Rust</Color>
</Colors>
<PurchaseDate>
2006-10-05 00:00:00.000
</PurcaseDate>
</Car>
{
“Make” : “Volkswagen”,
“Year” : 2003,
“Model” : {
“Base” : “Golf”,
“Trim” : “GL”
},
“Colors” :
[“White”, “Pearl”, Rust”],
“PurchaseDate” :
“2006-10-05T00:00:00.000Z”
}
XML: 225 Characters JSON: 145 Characters
9
Appropriate Usage
Staging Data
• Load data raw
• Validate
• Transform
10
Appropriate Usage
Error Logging
ErrorDate Component Data
2016-03-17 21:23:39 GetInventory { "Make : "Volkswagen", "Year" : 2003}
2016-03-19 12:59:31 Login { "User" : "Bert", "Referrer" : "http://google.com",
"AdditionalDetails" : "Invalid number of login attempts" }
11
Appropriate Usage
Non-Analytical Data
• Sessions
• User preferences
• Non-frequently changing variables
• Admin emails
• Static dropdown menus
12
Inappropriate Usage
High-Performance Requirements
13
Inappropriate Usage
Validation/Integrity Requirements
14
Inappropriate Usage
Being Lazy
Demos
1. ETL and reporting
2. Database object maintenance
3. Performance parsing w/ computed column indexes
4. SQL JSON vs XML vs .NET performance comparisons
15
Performance Results - XML
16
• JSON faster in almost all categories
• If considering entire app performance, maybe faster in
all categories
Performance Results - .NET
17
• Competitive with C# libraries
• Indexes on computed columns are BLAZING!
18
JSON – What’s new in SQL Server 2017?
• Clustered column store indexes support nvarchar(max)
• Compression
• Faster (maybe)
• In memory-optimized tables
• Computed columns
• All JSON functions supported
Recap
19
• Many good (and bad) uses for JSON in SQL exist
• JSON can be fully manipulated in SQL Server 2016
• JSON is preferable to XML for new projects
• JSON performance is comparable to .NET, faster with
computed column indexes
Thank you!
Twitter: @bertwagner
Blog: https://bertwagner.com <- new post every Tuesday
Vlog: https://bertwagner.com <- new video every Tuesday
Email: bert@bertwagner.com
20
21
Appendix
Software for keeping screen region on top
• On Top Replica
Blog posts and YouTube videos:
• SQL Server JSON Usage - Parsing
• SQL Server JSON Usage - Creating
• SQL Server JSON Usage - Updating, Adding, Deleting
• Performance Comparisons - .NET
• Performance Comparisons - XML
• Performance Comparisons - .NET and XML Redux
• JSON Computed Column Indexes
• Jovan Popovic’s JSON posts
Microsoft Connect
• Add an option to JSON_MODIFY() to fully delete values from arrays

More Related Content

PDF
Json usage and performance in sql server 2016
PDF
High Performance SSRS
PPTX
DBAs vs Developers - JSON in SQL Server
PPTX
DBAs vs Developers: JSON in SQL Server - CBusPASS
PDF
WEBridge 4 SAP ( Windchill and SAP Integration)
PDF
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
PPTX
Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016
PPTX
Building solutions with the SharePoint Framework - deep-dive
Json usage and performance in sql server 2016
High Performance SSRS
DBAs vs Developers - JSON in SQL Server
DBAs vs Developers: JSON in SQL Server - CBusPASS
WEBridge 4 SAP ( Windchill and SAP Integration)
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016
Building solutions with the SharePoint Framework - deep-dive

What's hot (19)

PDF
饿了么工作流介绍
PDF
MongoDB vs OrientDB
PPTX
Building solutions with the SharePoint Framework - introduction
PPTX
NoSQL Database in .NET Apps
PPS
WEBridge 4 SAP R 1.0
PPTX
Introduction presentation
PPTX
Mvc razor and working with data
PPTX
Web forms Overview Presentation
PPTX
Exciting Features for SQL Devs in SQL 2012
PDF
Trivadis TechEvent 2017 Tools and Methods for DB Migrations by Kim Berg Hansen
PDF
The XML Forms Architecture
PDF
Visualize your graph database
PDF
Building Read Models using event streams
PPTX
ASP.NET MVC overview
PDF
The journey of Moving from AWS ELK to GCP Data Pipeline
PDF
Static is just a cache
PDF
Async streams
PDF
WHYs and HOWs of Power Query to Power BI
PPTX
Grokking TechTalk #16: Html js and three way binding
饿了么工作流介绍
MongoDB vs OrientDB
Building solutions with the SharePoint Framework - introduction
NoSQL Database in .NET Apps
WEBridge 4 SAP R 1.0
Introduction presentation
Mvc razor and working with data
Web forms Overview Presentation
Exciting Features for SQL Devs in SQL 2012
Trivadis TechEvent 2017 Tools and Methods for DB Migrations by Kim Berg Hansen
The XML Forms Architecture
Visualize your graph database
Building Read Models using event streams
ASP.NET MVC overview
The journey of Moving from AWS ELK to GCP Data Pipeline
Static is just a cache
Async streams
WHYs and HOWs of Power Query to Power BI
Grokking TechTalk #16: Html js and three way binding
Ad

Similar to DBAs vs Developers: JSON in SQL Server (20)

PPTX
JSON in SQL Server 2016
PPTX
Demystifying JSON in SQL Server
PDF
Native JSON Support in SQL2016
PPTX
Sql Server 2016 and JSON
PPTX
JSON as a SQL Datatype
PPTX
Azure SQL & SQL Server 2016 JSON
PPTX
SQL Server 2016 JSON
PDF
JSON Support in DB2 for z/OS
PPTX
The rise of json in rdbms land jab17
PPTX
[Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support
PPTX
BGOUG15: JSON support in MySQL 5.7
PPTX
MySQL Rises with JSON Support
PDF
How to Use JSON in MySQL Wrong
PPT
The NoSQL Way in Postgres
 
PDF
Hybrid Databases - PHP UK Conference 22 February 2019
PDF
Using JSON with MariaDB and MySQL
PDF
Json in Postgres - the Roadmap
 
PDF
Json improvements in my sql 8.0
PPT
Do More with Postgres- NoSQL Applications for the Enterprise
 
PPTX
Compare SQL changes|SQL Database Modeler
JSON in SQL Server 2016
Demystifying JSON in SQL Server
Native JSON Support in SQL2016
Sql Server 2016 and JSON
JSON as a SQL Datatype
Azure SQL & SQL Server 2016 JSON
SQL Server 2016 JSON
JSON Support in DB2 for z/OS
The rise of json in rdbms land jab17
[Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support
BGOUG15: JSON support in MySQL 5.7
MySQL Rises with JSON Support
How to Use JSON in MySQL Wrong
The NoSQL Way in Postgres
 
Hybrid Databases - PHP UK Conference 22 February 2019
Using JSON with MariaDB and MySQL
Json in Postgres - the Roadmap
 
Json improvements in my sql 8.0
Do More with Postgres- NoSQL Applications for the Enterprise
 
Compare SQL changes|SQL Database Modeler
Ad

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Spectroscopy.pptx food analysis technology
DOCX
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Review of recent advances in non-invasive hemoglobin estimation
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectroscopy.pptx food analysis technology
The AUB Centre for AI in Media Proposal.docx

DBAs vs Developers: JSON in SQL Server

  • 1. DBAs vs Developers: JSON in SQL Server | Bert Wagner | September 30, 2017 1
  • 3. Background • BI developer @ Progressive Insurance for 6+ years • I ❤ JSON – I use it in APIs, hardware projects, websites • I also ❤ SQL – relational database structures 3
  • 4. Overview • What is JSON? • Why use JSON? • When is it appropriate to store JSON in SQL? • Usage examples: • ETL and reporting • Database object maintenance • Performance parsing • Performance comparisons 4
  • 5. 5 What does JSON look like? { “Make” : “Volkswagen”, “Year” : 2003, “Model” : { “Base” : “Golf”, “Trim” : “GL” }, “Colors” : [“White”, “Pearl”, “Rust”], “PurchaseDate” : “2006-10-05T00:00:00.000Z” }
  • 6. 6 Why use JSON? Easy Processing var car = { "Make" : "Volkswagen" }; console.log(car.Make); // Output: Volkswagen car.Year = 2003; console.log(car); // Output: { "Make" : "Volkswagen", "Year" : 2003" } Javascript:
  • 8. 8 Why use JSON? Storage Size <Car> <Make>Volkswagen</Make> <Year>2003</Year> <Model> <Base>Golf</Base> <Trim>GL</Trim> </Model> <Colors> <Color>White</Color> <Color>Pearl</Color> <Color>Rust</Color> </Colors> <PurchaseDate> 2006-10-05 00:00:00.000 </PurcaseDate> </Car> { “Make” : “Volkswagen”, “Year” : 2003, “Model” : { “Base” : “Golf”, “Trim” : “GL” }, “Colors” : [“White”, “Pearl”, Rust”], “PurchaseDate” : “2006-10-05T00:00:00.000Z” } XML: 225 Characters JSON: 145 Characters
  • 9. 9 Appropriate Usage Staging Data • Load data raw • Validate • Transform
  • 10. 10 Appropriate Usage Error Logging ErrorDate Component Data 2016-03-17 21:23:39 GetInventory { "Make : "Volkswagen", "Year" : 2003} 2016-03-19 12:59:31 Login { "User" : "Bert", "Referrer" : "http://google.com", "AdditionalDetails" : "Invalid number of login attempts" }
  • 11. 11 Appropriate Usage Non-Analytical Data • Sessions • User preferences • Non-frequently changing variables • Admin emails • Static dropdown menus
  • 15. Demos 1. ETL and reporting 2. Database object maintenance 3. Performance parsing w/ computed column indexes 4. SQL JSON vs XML vs .NET performance comparisons 15
  • 16. Performance Results - XML 16 • JSON faster in almost all categories • If considering entire app performance, maybe faster in all categories
  • 17. Performance Results - .NET 17 • Competitive with C# libraries • Indexes on computed columns are BLAZING!
  • 18. 18 JSON – What’s new in SQL Server 2017? • Clustered column store indexes support nvarchar(max) • Compression • Faster (maybe) • In memory-optimized tables • Computed columns • All JSON functions supported
  • 19. Recap 19 • Many good (and bad) uses for JSON in SQL exist • JSON can be fully manipulated in SQL Server 2016 • JSON is preferable to XML for new projects • JSON performance is comparable to .NET, faster with computed column indexes
  • 20. Thank you! Twitter: @bertwagner Blog: https://bertwagner.com <- new post every Tuesday Vlog: https://bertwagner.com <- new video every Tuesday Email: bert@bertwagner.com 20
  • 21. 21 Appendix Software for keeping screen region on top • On Top Replica Blog posts and YouTube videos: • SQL Server JSON Usage - Parsing • SQL Server JSON Usage - Creating • SQL Server JSON Usage - Updating, Adding, Deleting • Performance Comparisons - .NET • Performance Comparisons - XML • Performance Comparisons - .NET and XML Redux • JSON Computed Column Indexes • Jovan Popovic’s JSON posts Microsoft Connect • Add an option to JSON_MODIFY() to fully delete values from arrays

Editor's Notes

  • #6: What is JSON, where it used, why is it used