citus is a free, open source databases project written in C and released under AGPL-3.0. It has 12,776 GitHub stars, 795 forks and 1,075 open issues, and was last pushed 5 hours ago. On this registry it ranks #66 of 143 tracked projects in Databases, with 5 head-to-head comparisons available.

What is citus?

Citus is an AGPL-3.0 licensed PostgreSQL extension, written in C, that turns an ordinary Postgres server into a distributed database for teams whose applications have outgrown a single PostgreSQL node.

What it is

Citus is a PostgreSQL extension, not a fork and not a separate database engine. It is installed into an existing Postgres server and adds distributed tables that are sharded across a cluster of PostgreSQL nodes so the cluster can combine their CPU, memory, storage and I/O capacity. Reference tables are replicated to all nodes for joins and foreign keys from distributed tables and to maximize read performance. A distributed query engine routes and parallelizes SELECT, DML and other operations on distributed tables across the cluster, and queries can be issued from any node. Columnar storage compresses data, speeds up scans and supports fast projections on both regular and distributed tables. Because it is an extension, Citus runs on the latest PostgreSQL versions and works with the PostgreSQL tools and extensions already in use. The project is published at citusdata/citus under AGPL-3.0, with 12,776 stars and 795 forks on GitHub.

The concrete problem it solves is the single PostgreSQL node that is running out of room. When data size and volume grow, a single node starts to show high CPU utilization and I/O wait times that slow queries, SQL queries that return out of memory errors, and autovacuum that cannot keep up and increases table bloat. Citus distributes and optionally compresses those tables so the deployment always has enough memory, CPU and I/O capacity to achieve high performance at scale. It also replaces the single-node ceiling as a deployment target: a Citus cluster can start on a single Citus node that is scale-out ready and grow into a large cluster, and worker nodes can be added later with the shards rebalanced.

Key capabilities

  • Distributed tables sharded across a cluster of PostgreSQL nodes to combine CPU, memory, storage and I/O capacity.
  • Reference tables replicated to every node for joins and foreign keys from distributed tables and for maximum read performance.
  • Distributed query engine that routes and parallelizes SELECT, DML and other operations across the cluster.
  • Columnar storage for compression, faster scans and fast projections, on regular and distributed tables alike.
  • Query from any node, which lets a distributed query use the full capacity of the cluster.
  • Schema-based sharding, documented as its own section alongside the standard table-based approach.
  • Shard rebalancing, so worker nodes can be added as data size and volume grow.
  • Debian and RPM packages published on packagecloud, with the Citus 13.0 release distributing PostgreSQL 17.

Who uses it and how

  • Multi-tenant applications that need high transaction throughput, where each tenant's data is distributed across the cluster.
  • Analytical workloads that need fast queries over large tables, using the distributed query engine and columnar storage.
  • Time series and IoT data pipelines feeding real-time analytics, where volume grows continuously and nodes are added as it does.
  • Small deployments that begin on a single Citus node and only need scale-out readiness, with no cluster to operate yet.
  • Production clusters set up with high availability, which the README treats as a distinct deployment scenario.

Getting started

The README points to its Getting Started and Using Citus sections, and the project ships Debian (.deb) and RPM packages through its packagecloud community repositories for installation into an existing PostgreSQL server.

How it compares

The only related system named in the provided facts is PostgreSQL itself, since Citus is an extension layered onto an unmodified Postgres server rather than a replacement for it. No alternative distributed database is named in these facts, so on the evidence available Citus stands alone in this registry.

When to use it — and when not to

A self-hoster takes on a PostgreSQL deployment plus worker nodes, shard rebalancing and, for production, a high-availability setup; the README documents these as separate engineering concerns rather than a turnkey service. Teams that cannot accept the AGPL-3.0 copyleft licence, or that have no intention of ever exceeding a single Postgres node, gain little from the added cluster complexity. The repository also carries 1,075 open issues, and the README excerpt is dense and cut off mid-sentence, so readers should treat the linked documentation as the authoritative source.

project readme (upstream, from github) — read inline

The Citus database is 100% open source.

Learn what's new in the Citus 13.0 release blog and the Citus Updates page.


Citus Banner

Latest Docs Stack Overflow Slack Code Coverage Twitter

Citus Deb Packages Citus Rpm Packages

What is Citus?

Citus is a PostgreSQL extension that transforms Postgres into a distributed database—so you can achieve high performance at any scale.

With Citus, you extend your PostgreSQL database with new superpowers:

  • Distributed tables are sharded across a cluster of PostgreSQL nodes to combine their CPU, memory, storage and I/O capacity.
  • Reference tables are replicated to all nodes for joins and foreign keys from distributed tables and to maximize read performance.
  • Distributed query engine routes and parallelizes SELECT, DML, and other operations on distributed tables across the cluster.
  • Columnar storage compresses data, speeds up scans, and supports fast projections, both on regular and distributed tables.
  • Query from any node enables you to utilize the full capacity of your cluster for distributed queries

You can use these Citus superpowers to make your Postgres database scale-out ready on a single Citus node. Or you can build a large cluster capable of handling high transaction throughputs, especially in multi-tenant apps, run fast analytical queries, and process large amounts of time series or IoT data for real-time analytics. When your data size and volume grow, you can easily add more worker nodes to the cluster and rebalance the shards.

Our SIGMOD '21 paper Citus: Distributed PostgreSQL for Data-Intensive Applications gives a more detailed look into what Citus is, how it works, and why it works that way.

Citus scales out from a single node

Since Citus is an extension to Postgres, you can use Citus with the latest Postgres versions. And Citus works seamlessly with the PostgreSQL tools and extensions you are already familiar with.

Why Citus?

Developers choose Citus for two reasons:

  1. Your application is outgrowing a single PostgreSQL node

    If the size and volume of your data increases over time, you may start seeing any number of performance and scalability problems on a single PostgreSQL node. For example: High CPU utilization and I/O wait times slow down your queries, SQL queries return out of memory errors, autovacuum cannot keep up and increases table bloat, etc.

    With Citus you can distribute and optionally compress your tables to always have enough memory, CPU, and I/O capacity to achieve high performance at scale. The distributed query engine can efficiently route transactions across the cluster, while parallelizing analytical queries and batch operations across all cores. Moreover, you can still use the PostgreSQL features and tools you know and love.

  2. PostgreSQL can do things other systems can’t

    There are many data processing systems that are built to scale out, but few have as many powerful capabilities as PostgreSQL, including: Advanced joins and subqueries, user-defined functions, update/delete/upsert, constraints and foreign keys, powerful extensions (e.g. PostGIS, HyperLogLog), many types of indexes, time-partitioning, and sophisticated JSON support.

    Citus makes PostgreSQL’s most powerful capabilities work at any scale, allowing you to handle complex data-intensive workloads on a single database system.

Getting Started

The quickest way to get started with Citus is to use the Azure Cosmos DB for PostgreSQL managed service in the cloud—or set up Citus locally.

Citus Managed Service on Azure

You can get a fully-managed Citus cluster in minutes through the Azure Cosmos DB for PostgreSQL portal. Azure will manage your backups, high availability through auto-failover, software updates, monitoring, and more for all of your servers. To get started with Citus on Azure, use the Azure Cosmos DB for PostgreSQL Quickstart.

Running Citus using Docker

The smallest possible Citus cluster is a single PostgreSQL node with the Citus extension, which means you can try out Citus by running a single Docker container.

# run PostgreSQL with Citus on port 5500
docker run -d --name citus -p 5500:5432 -e POSTGRES_PASSWORD=mypassword citusdata/citus

# connect using psql within the Docker container
docker exec -it citus psql -U postgres

# or, connect using local psql
psql -U postgres -d postgres -h localhost -p 5500

Install Citus locally

If you already have a local PostgreSQL installation, the easiest way to install Citus is to use our packaging repo

Install packages on Ubuntu / Debian:

curl https://install.citusdata.com/community/deb.sh > add-citus-repo.sh
sudo bash add-citus-repo.sh
sudo apt-get -y install postgresql-17-citus-13.0

Install packages on Red Hat:

curl https://install.citusdata.com/community/rpm.sh > add-citus-repo.sh
sudo bash add-citus-repo.sh
sudo yum install -y citus130_17

To add Citus to your local PostgreSQL database, add the following to postgresql.conf:

shared_preload_libraries = 'citus'

After restarting PostgreSQL, connect using psql and run:

CREATE EXTENSION citus;

You’re now ready to get started and use Citus tables on a single node.

Install Citus on multiple nodes

If you want to set up a multi-node cluster, you can also set up additional PostgreSQL nodes with the Citus extensions and add them to form a Citus cluster:

-- before adding the first worker node, tell future worker nodes how to reach the coordinator
SELECT citus_set_coordinator_host('10.0.0.1', 5432);

-- add worker nodes
SELECT citus_add_node('10.0.0.2', 5432);
SELECT citus_add_node('10.0.0.3', 5432);

-- rebalance the shards over the new worker nodes
SELECT rebalance_table_shards();

For more details, see our documentation on how to set up a multi-node Citus cluster on various operating systems.

Using Citus

Once you have your Citus cluster, you can start creating distributed tables, reference tables and use columnar storage.

Creating Distributed Tables

The create_distributed_table UDF will transparently shard your table locally or across the worker nodes:

CREATE TABLE events (
  device_id bigint,
  event_id bigserial,
  event_time timestamptz default now(),
  data jsonb not null,
  PRIMARY KEY (device_id, event_id)
);

-- distribute the events table across shards placed locally or on the worker nodes
SELECT create_distributed_table('events', 'device_id');

After this operation, queries for a specific device ID will be efficiently routed to a single worker node, while queries across device IDs will be parallelized across the cluster.

-- insert some events
INSERT INTO events (device_id, data)
SELECT s % 100, ('{"measurement":'||random()||'}')::jsonb FROM generate_series(1,1000000) s;

-- get the last 3 events for device 1, routed to a single node
SELECT * FROM events WHERE device_id = 1 ORDER BY event_t

readme truncated — read the full docs on github

Frequently asked questions

Is citus free to use?

citus is open source under the AGPL-3.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does citus do?

Distributed PostgreSQL as an extension

What is citus written in?

citus is primarily written in C. Its source is publicly available at https://github.com/citusdata/citus, and it has 12,776 GitHub stars.