SQL

2024 Dec 09

Killing a PostgreSQL Connection

Let’s kill a PG connection

2024 Dec 09

PostgreSQL Schemas: Namespacing for Objects

For organizing objects in your DB, or setting up multi-tenancy

2024 Dec 09

PostgreSQL: Create a Read-only User/Group

Let’s create a read only group in PG and add users to it

2024 Nov 29

Timeseries and ASOF Joins

Pairing up timeseries data when the timestamps don’t match exactly (in Pandas, Polars, DuckDB, Postgres & QuestDB)

2024 Oct 17

Graph Query Interfaces: A Comparison Between SQL and Cypher

Featuring DuckDB & KuzuDB

2023 Jul 25

Wrangling JSON with DuckDB

For when you need to impose some structure on semi-structured data

2023 Jun 24

Lateral Joins & Iterators in SQL

Sneaking for-loops into SQL without anyone noticing

2023 Jun 22

SQL Grouping sets, Rollups & Cube

Computing multiple Group-bys with less steps

2020 Jun 07

Generalized Range Difference, Recursion & Search Availability in PostgreSQL

We’re building a scheduling app. Users mark booked slots, represented in Postgres using time or date-range data types. Let’s see how we can find all the freely available slots efficiently

2020 May 28

Speeding up unique constraint checks in PostgreSQL... or not

Are exclusion constraints using hash indexes faster than plain old uniqueness checks? Let’s find out

2020 May 27

SQL gotcha: now() vs 'now'

Make sure you’re using the correct defaults when defining columns

2020 Jan 06

Back To Basics: The foundation of Joins in SQL

Writing SQL joins without using joins at all. A quick history of Database Models, Schemas, Constraints, Cross-products and everything in between

2020 Jan 03

SQL joins as reduce/folds over relations

Of what to make of joins in sql, mental models and building better understanding

2019 Nov 20

PG Transactions & Isolation levels: Airline Seat Booking

Using the right isolation level to avoid nasty billing errors when building database-managed booking systems