Planet PostgreSQL - 2023-07-18T09:53:12Z
What if you could automatically shard your PostgreSQL database across any number of servers and get industry-leading performance at scale without any special data modelling steps?
Our latest Citus open source release, Citus 12, adds a new and easy way to transparently scale your Postgres database: Schema-based sharding, where the database is transparently sharded by schema name.
Schema-based sharding gives an easy path for scaling out several important classes of applications that can divide their data across schemas:
Multi-tenant SaaS applications
Microservices that use the same database
Vertical partitioning by groups of tables
Each of these scenarios can now be enabled on Citus using regular CREATE SCHEMA commands. That way, many existing applications and libraries (e.g. django-tenants) can scale out without any changes, and developing new applications can be much easier. Moreover, you keep all the other benefits of Citus, including distributed transactions, reference tables, rebalancing, and more.
In this blog post, you’ll get a high-level overview of schema-based sharding and other new Citus 12 features:
What is schema-based sharding?
How to use Citus schema-based sharding for Postgres
Benefits of schema-based sharding
Choosing a sharding model for multi-tenant applications (schema-based vs. row-based)
Migrating an existing schema-per-tenant application to Citus
MERGE improvements
Even more details available in the release notes on the 12.0 Updates page. And if you want to see demos of some of this functionality, be sure to join us for the livestream of the Citus 12.0 release party on Wed 02 Aug (mark your calendar and join us.
Let’s dive in!
What is schema-based sharding?
Schema-based sharding means that tables from the same schema are placed on the same node, while different schemas may be on different nodes. That way, queries and transactions that involve a single schema can always be evaluate[...]
AI生成摘要
Citus 12, the latest open source release, introduces schema-based sharding for PostgreSQL databases. This feature allows for transparent scaling of databases by dividing data across schemas. It is particularly useful for multi-tenant SaaS applications, microservices, and vertical partitioning scenarios. Schema-based sharding can be enabled by creating distributed schemas using regular CREATE SCHEMA commands. This feature provides benefits such as easy shard management, automatic rebalancing, data sharing across schemas, and more. Schema-based sharding can be used alongside row-based sharding for different workload patterns. The text also discusses the benefits and considerations of schema-based sharding, as well as how to use it in Citus 12. Additionally, it mentions the MERGE command and its compatibility with schema-based sharding in Citus 12.