Learn How to Create Dynamic Partitions with PostgreSQL

A step by step guide to automatically shard your big data tables

Songtham Tung
5 min readOct 30, 2018

--

I used to lead a tech team in a previous company where we had a business requirement to analyze chat data for our live trivia mobile app.

While seemingly simple, this effort required us to pause and consider the following question:

“How can we efficiently read and write chat data?”

With over a million users and counting, our chat database can grow really big and really fast — so it’s all about scalability. In response, the answer is partitioning!

Some basic definitions

Before we get started, here’s a few basic terms.

  • Partitioning refers to splitting a large table into smaller tables.
  • Dynamic refers to constantly changing.
  • Dynamic Partitioning thus refers to automatically splitting a large table into smaller tables.

Now that we’re on the same page, let’s go more in depth on how we can achieve dynamic partitioning with PostgreSQL!

--

--

Songtham Tung

Technical Account Manager | 1M+ Reads | 🇺🇸🇹🇭