Home / Companies / Yugabyte / Blog / Post Details
Content Deep Dive

Differences in Primary Key Usage Between Colocated and Non-Colocated Tables

Blog post from Yugabyte

Post Details
Company
Date Published
Author
Kavya Shivashankar
Word Count
1,240
Company Posts That Month
17
Language
English
Hacker News Points
-
Post removed?
No
Summary

YugabyteDB is a distributed SQL database that supports both colocated and non-colocated tables, which are useful for specific use cases. A non-colocated database has all tables distributed across the nodes in a cluster, with hash sharding applied by default and partition columns used to determine node placement. In contrast, a colocated database is created using a CREATE DATABASE command with the WITH COLOCATION = 'true' option, where all tables are colocated unless explicitly declared otherwise. Colocated tables are organized by the sort order of their primary key columns in one tablet only, while non-colocated or distributed tables can be hash sharded and also range sharded if needed. The choice between colocated and non-colocated tables depends on the specific use case and requirements of the application.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.