Download presentation
Presentation is loading. Please wait.
1
DBAs vs Developers: JSON in SQL Server 2016
| Bert Wagner | July 22, 2017
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
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
5
What does JSON look like?
{ “Make” : “Volkswagen”, “Year” : 2003, “Model” : { “Base” : “Golf”, “Trim” : “GL” }, “Colors” : [“White” , “Rust”], , “Pearl” “PurchaseDate” : “ T00:00:00.000Z” } What is JSON, where it used, why is it used
6
Why use JSON? Easy Processing
Javascript: var car = { "Make" : "Volkswagen" }; console.log(car.Make); // Output: Volkswagen car.Year = 2003; console.log(car); // Output: { "Make" : "Volkswagen", "Year" : 2003" }
7
Why use JSON? APIs
8
Why use JSON? Storage Size
XML: 225 Characters JSON: 145 Characters <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> :00:00.000 </PurcaseDate> </Car> { “Make” : “Volkswagen”, “Year” : 2003, “Model” : { “Base” : “Golf”, “Trim” : “GL” }, “Colors” : [“White”, “Pearl”, Rust”], “PurchaseDate” : “ T00:00:00.000Z” }
9
Appropriate Usage Staging Data
Load data raw Validate Transform
10
Appropriate Usage Error Logging
ErrorDate Component Data :23:39 GetInventory { "Make : "Volkswagen", "Year" : 2003} :59:31 Login { "User" : "Bert", "Referrer" : " "AdditionalDetails" : "Invalid number of login attempts" }
11
Appropriate Usage Non-Analytical Data
Sessions User preferences Non-frequently changing variables Admin s Static dropdown menus
12
High-Performance Requirements
Inappropriate Usage High-Performance Requirements
13
Validation/Integrity Requirements
Inappropriate Usage Validation/Integrity Requirements
14
Inappropriate Usage Being Lazy
15
Demos ETL and reporting Database object maintenance
Performance parsing w/ computed column indexes SQL JSON vs XML vs .NET performance comparisons
16
Performance Results - XML
JSON faster in almost all categories If considering entire app performance, maybe faster in all categories
17
Performance Results - .NET
Competitive with C# libraries Indexes on computed columns are BLAZING!
18
Recap 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
19
Thank you! Twitter: @bertwagner
Blog: <- new post every Tuesday YouTube: <- new video every Tuesday
20
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 Microsoft Connect Add an option to JSON_MODIFY() to fully delete values from arrays
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.