Citus

Crunchy Bridge supports Citus on all three major cloud providers. If you're unfamiliar with Citus, it is an extension to Postgres that turns Postgres into a sharded, distributed, horizontally scalable database. If that sounds confusing, don't worry, we'll walk you through it.

What is Citus

Citus connects multiple Postgres instances together so that they appear to your application like they're a single node. While your application does not need to know about Citus specifically, the effectiveness of a Citus implementation depends strongly on how you define your data model and queries.

In ideal cases, most of your actual data will live on your Citus worker nodes. These nodes consist of sharded (also called distributed) tables. The worker nodes typically do the heavy lifting. Joins are best performed locally on workers.

When you connect to Citus, you will not connect directly to a worker node. Instead, you connect to the coordinator node just like you would connect to a standard Postgres instance. The coordinator node acts as a broker to the worker nodes where the actual data resides.

With a configured Citus cluster, you'll use standard SQL to create tables. Once the tables exist, you will leverage Citus to distribute the data to shards. By default, Citus will create 32 shards and spread those evenly across each worker node in your cluster. It's ideal to create a shard count of at least 4x the number of nodes in your cluster. That number could also be much higher if you have highly resourced worker instances. A larger number of shards than worker nodes allows you to easily scale out (add worker nodes) and use the Citus rebalancer.

Get started using Citus on Crunchy Bridge with our quickstart guide.