351: Moving to PostgreSQL from MySQL

As you read this, CodePen is 100% on PostgreSQL for our main relational database. It was a transition that took a couple weeks of pretty intense effort, and lots of planning and prep before that. I’ve got Alex on the show to talk about it, as he was the main instigator and led the effort, but everyone contributed in some way.

Wondering why? Well…

  • We were on a pretty old version of MySQL (5.6), and upgrading to something more modern (like 8) would have required just as much effort, so we thought we’d move on to something we saw more value in.
  • We’re undertaking big new efforts that require a bunch of data specific work. It’ll be more work to change after that, so it felt like a now or never situation.
  • PostgreSQL means consolidating of technology, which is big for our small team. We’ve done some of this, and it opens the door for more. For example, we can stop using Elasticsearch as a totally separate database for search and lean on PostgreSQL. The same goes for an analytics-focused database, job queuing, and even potentially static asset hosting.

There is a lot to talk about here, so we get into all the nitty-gritty detail, including how we pulled it off with near-zero downtime and the tools involved.

Time Jumps

  • 00:16 CodePen switched databases
  • 01:08 Team effort
  • 03:16 Is it a big paradigm shift?
  • 06:53 Using ElasticSearch
  • 13:34 Recapping the why
  • 16:14 We have some in house experience with PostGres
  • 17:17 Sponsor: WooCommerce
  • 18:50 How did we do the transition?
  • 27:23 How long did it take to move the data?
  • 31:14 How the migration went
  • 36:53 What enabled this to be possible
  • 41:06 Any negatives or issues?

Sponsor: WooCommerce

WooCommerce is eCommerce for WordPress. It’s powerful software in that it can do anything you could ever want to do in selling online. You can sell physical products. You can sell digital and downloadable products. You can sell memberships or tickets or appointments. The sky is the limit. I’ve used it personally for all those things and have had a great experience every time.

The post 351: Moving to PostgreSQL from MySQL appeared first on CodePen Blog.