Improve Performance Using SQL Functions in Postgres

We’ve all hit that point on a project: features are working, and you’re starting to really expand the application’s capabilities, but the expansion is steadily leading to slower performance. It’s time for some refactoring around your database interactions Maybe the queries run by the application have become more and more complex. Maybe there are things […]

A Simple Approach to Complicated Database Defaults

Database tables rarely stay the same over the course of a project. We often need to add tables, add or rename columns, or break up a table to support evolving project demands or updated domain modeling. Migrating existing data correctly is not always trivial. Here are two scenarios I ran into recently on a project […]

Using SQL to Look Through All of Your iMessage Text Messages

iMessage is one of my favorite things about having an iPhone and a Mac. It’s also one of my least favorite things. I love being able to send messages from my computer, and the integration between the two devices is seamless. What frustrates me is the inability to efficiently search through old messages. iOS 13 […]

Level up your PostgreSQL Skill with Lateral Joins

PostgreSQL’s lateral joins have a lot of uses. One of my favorites is the ability to reuse calculations in a query. Before I discovered lateral joins, I would either copy calculations throughout the query or use subqueries. Neither of these approaches is ideal because they make the query much more difficult to read—and nearly impossible […]