Percona Live 2018 Featured Talk: How to Use JSON in MySQL Wrong with Bill Karwin

Welcome to the first interview blog for the upcoming Percona Live 2018. Each post in this series highlights a Percona Live 2018 featured talk that will be at the conference and gives a short preview of what attendees can expect to learn from the presenter.This blog post highlights Bill Karwin, Database Developer at Square. His talk is titled How to Use JSON in MySQL Wrong. JSON is a fairly recent addition to MySQL, and it can be massively useful – as long as you are clear on how to best use it. In our conversation, we discussed how JSON can be helpful to DBAs:

Percona: Who are you, and how did you get into databases? What was your path to your current responsibilities?

Bill: I started using databases like most developers – by accident. Later I had a job as a support engineer and trainer for a relational database called InterBase, and I got to know how much databases form the foundation of all modern applications. I helped hundreds of companies with database design, SQL queries and database performance tuning.

Percona: Your talk is titled “How to Use JSON in MySQL Wrong”. When is JSON most useful in MySQL/MariaDB? What does it do to make a DBA’s life easier?

Bill: JSON is useful for storing semi-structured data. Some applications must support data whose structure that isn’t known at development time. But the database still has to provide access to fields within data. In a traditional relational database, this would require frequent schema changes to add new columns. But JSON gives us a way to encode and store data that is comprised of fields, without making strict schema changes.

Percona: How does JSON get misused? When is it not the optimal choice?

Bill: Developers misuse JSON when they rely on it too much or use it as an excuse to skip database design. They might get into the habit of storing fields in JSON by default – even those that should be stored in traditional columns. As a result, the database takes up too much storage, queries are complex and hard to optimize. They sacrifice useful features like constraints and data types, weakening their data integrity.

Percona: What is your best advice for somebody new to using JSON?

Bill: First, learn how to use a relational database the traditional way. Treat JSON as an exception to the rule. It’s a useful tool, but one you should use sparingly.

Percona: Why should people attend your talk? What do you hope people will take away from it?

Bill: People should attend my talk because JSON is growing in popularity and demand. We need to think about the pros and cons of semi-structured data, and how to get the best value from it without painting ourselves into a corner.

Percona: What are you looking forward to at Percona Live (besides your talk)?

Bill: I always look forward to talking to the leaders of the open source database community, and immersing myself in the latest products and services for managing data at high scale. You always learn new things at Percona Live, and can’t wait to get back to work to try out some new software!