Sharding
Reference Tables
A reference table is a table that is fully replicated across all shards instead of being divided into separate partitions. This allows every shard to have a local copy of the table, reducing network overhead and ensuring fast access to frequently used data.
Reference tables are useful when you need:
- Consistent access to shared data across all shards.
- Fast lookups without cross-shard queries.
- Integrity constraints on small tables used across different parts of an application.
Examples
Some typical use cases for reference tables include:
- eCommerce: Sales tax rates apply to all stores.
- Common codes: A table with country codes and region names.
- Roles: A system-wide list of roles and permissions.
- Finance: Exchange rates.
- Global settings: Settings or feature flags.
- SaaS: A table defining different subscription tiers, their pricing, and feature sets.
How to use it?
To create a reference table, use the SPQR administrative console:
Then, create the table and insert data:
Verify replication:
Was this page helpful?