DEV Community

Most Complete Auto-Sharding and Partitioning Strategies

Though distributed, YugabyteDB provides a global logical database with all features like unique constraints (primary keys and unique indexes) and referential integrity (foreign keys) without limitations. It uses a combination of partitioning and sharding.

  • Sharding in the storage layer automatically distributes table rows, index entries, and transaction intents. The tables and indexes are split into "tablets" by range, and when they grow, they are split automatically to keep their size optimal for rebalancing and replication. The developer also has the option to apply a hash function on the key or a prefix of the key, used only with equality predicates, to distribute immediately before the table grows.

  • PostgreSQL declarative partitioning methods, by range, list, and hash, are used on top of the built-in sharding to group rows and index entries based on a sub-part of the primary key. The goal is to isolate data for data sovereignty or lifecycle management so indexes are local to the table partitions.

These two features are typically combined, with the table and index partitions distributed like regular tables and indexes. The partitions can be assigned to tablespaces to define the placement blocks within the cloud or on-premises topology. For example, you typically partition by a list of countries to store user data into specific regions, with each partition being distributed, with consistent hashing or ranges of key values, and replicated across multiple availability zones in that region.


Oracle Sharding methods compared to YugabyteDB

Oracle has long been a leader in partitioning, distributing, and replicating databases. They offer shared-storage RAC for High Availability and Log-Streaming Data Guard for Disaster Recovery.

favicon linkedin.com

Top comments (0)