Recent Articles - Databases

Inner vs. Outer Joins

Apr 29, 2022 · 16 min read

They can't be used interchangeably, and the differences are important.


Creating a MySQL Playground

Apr 27, 2022 · 4 min read

It's helpful to have local throwaway environments for rapid development, especially with databases, and creating one for MySQL is a snap with Docker.


Creating a PostgreSQL Playground

Apr 27, 2022 · 4 min read

It's helpful to have local throwaway environments for rapid development, especially with databases, and creating one for PostgreSQL is a snap with Docker.


Creating a Gremlin Playground

Apr 22, 2022 · 6 min read

Apache TinkerPop's Gremlin graph traversal language can be confusing to learn, but thankfully TinkerPop provides some "toy" graphs perfect to learn with.


Finding Long-Running Queries in MySQL

Dec 22, 2021 · 4 min read

Poorly optimized queries and excessive connections can cause problems in MySQL, here's a quick way to identify and kill them.


Finding Long-Running Queries in PostgreSQL

Nov 26, 2021 · 2 min read

Poorly optimized queries and excessive connections can cause problems in PostgreSQL, here's a quick way to identify and kill them.


Calculating Table Size in PostgreSQL

Nov 26, 2021 · 2 min read

Knowing how much disk space individual tables take up is important for DB maintenance and debugging, and it can be accomplished with a single query in PostgreSQL.


Making UUIDs More Performant in MySQL

Nov 14, 2020 · 3 min read

MySQL does not have a native UUID type, so strings are often used instead, which come with large storage and performance costs.


Generating v4 UUIDs in MySQL

Nov 13, 2020 · 3 min read

MySQL's UUID() function generates v1 UUIDs, which have a time component that make them unevenly distributed over short periods of time. We can define our own function to generate v4 UUIDs, which are random and therefore more evenly distributed.


Faking Sequences in MySQL

Nov 11, 2020 · 4 min read

MySQL doesn't have a concept of custom sequences that other databases such as PostgreSQL do, but they can be faked with a table and some clever queries.


Why You Should Use UUIDs for Your Primary Keys

Jan 30, 2020 · 4 min read

Universally unique identifiers (UUIDs) are 128-bit (16-byte) numbers that are designed to be globally unique, and as a result they make for great primary keys.


Tunneling a Database Connection with Docker Compose

Aug 7, 2019 · 3 min read

I recently had the need to tunnel a database connection from a local Docker container to a remote MySQL server. The AWS RDS instance is inside the same VPC as a bastion host that runs the SSH server. Rather than open the tunnel on the host machine and have the container connect through host.docker.internal I thought I'd configure it all in one place with Docker Compose.