You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/postgresql/concepts-sharding-models.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,18 +51,16 @@ Drawbacks:
51
51
52
52
## Sharding tradeoffs
53
53
54
-
<br />
55
-
56
-
|| Schema-based sharding | Row-based sharding|
57
-
|---|---|---|
58
-
|Multi-tenancy model|Separate schema per tenant|Shared tables with tenant ID columns|
59
-
|Citus version|12.0+|All versions|
60
-
|Extra steps compared to vanilla PostgreSQL|None, only a config change|Use create_distributed_table on each table to distribute & colocate tables by tenant ID|
61
-
|Number of tenants|1-10k|1-1 M+|
62
-
|Data modeling requirement|No foreign keys across distributed schemas|Need to include a tenant ID column (a distribution column, also known as a sharding key) in each table, and in primary keys, foreign keys|
63
-
|SQL requirement for single node queries|Use a single distributed schema per query|Joins and WHERE clauses should include tenant_id column|
|Data sharing across tenants|Yes, using reference tables (in a separate schema)|Yes, using reference tables|
68
-
|Tenant to shard isolation|Every tenant has its own shard group by definition|Can give specific tenant IDs their own shard group via isolate_tenant_to_new_shard|
54
+
|| Schema-based sharding | Row-based sharding |
55
+
| --- | --- | --- |
56
+
|**Multi-tenancy model**| Separate schema per tenant | Shared tables with tenant ID columns |
57
+
|**Citus version**| 12.0+ | All versions |
58
+
|**Extra steps compared to vanilla PostgreSQL**| None, only a config change | Use create_distributed_table on each table to distribute & colocate tables by tenant ID |
59
+
|**Number of tenants**| 1-10k | 1-1 M+ |
60
+
|**Data modeling requirement**| No foreign keys across distributed schemas | Need to include a tenant ID column (a distribution column, also known as a sharding key) in each table, and in primary keys, foreign keys |
61
+
|**SQL requirement for single node queries**| Use a single distributed schema per query | Joins and WHERE clauses should include tenant_id column |
62
+
|**Parallel cross-tenant queries**| No | Yes |
63
+
|**Custom table definitions per tenant**| Yes | No |
|**Data sharing across tenants**| Yes, using reference tables (in a separate schema) | Yes, using reference tables |
66
+
|**Tenant to shard isolation**| Every tenant has its own shard group by definition | Can give specific tenant IDs their own shard group via isolate_tenant_to_new_shard |
0 commit comments