This session will explore the new JSON functionality introduced in SQL Server 2016 and what improvements are added with 2017. We will use T-SQL examples to learn how these functions can be used to parse, create, and modify JSON data. More importantly, we will discuss how to optimize performance when using these functions.
By the end of this session DBAs and developers will know how to efficiently work with JSON in SQL Server 2016.
Download demos
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
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