Cockroachdb
A comprehensive skill catalog for AI agents
npx -y skills add G1Joshi/Agent-Skills --skill cockroachdbAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
CockroachDB distributed SQL database. Use for geo-distributed data.
SKILL.md
2.1 KB, 491 tokens by cl100k_base, as published. Nobody here has run it
CockroachDB
CockroachDB is a cloud-native, distributed SQL database. It survives disk, machine, rack, and even datacenter failures with zero downtime. It speaks PostgreSQL.
When to Use
- Global/Multi-Region Apps: "Geo-partitioning" ties data to specific locations for low latency and compliance (GDPR).
- Financial Ledgers: Strong consistency (Serializable Isolation) is the default.
- Serverless (2025): Use CockroachDB Serverless for auto-scaling from zero to millions of requests without managing nodes.
Quick Start
-- Create a table (Primary Key defaults to UUID in 2025 best practices)
CREATE TABLE accounts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
balance DECIMAL(19,4)
);
-- Distributed Transaction
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 'uuid-1';
UPDATE accounts SET balance = balance + 100 WHERE id = 'uuid-2';
COMMIT;
Core Concepts
Ranges
Data is broken into 512MB chunks called "Ranges". These are replicated (Raft consensus) across 3+ nodes.
Geo-Partitioning
You can tell the DB: "Keep German users' data in EU servers, and US users in US servers" using SQL ALTER TABLE ... PARTITION BY ....
Follow-the-Workload
The database automatically moves "leaseholders" (read/write leaders) close to where the requests are coming from for low latency.
Best Practices (2025)
Do:
- Use UUIDs: Sequential keys (1, 2, 3) cause "hot spots" (all writes go to one Range). UUIDs distribute load.
- Use Serverless: For most start-ups/mid-size apps, the Serverless consumption model is cheaper and easier than managing nodes.
- Retry Transactions: In a distributed system, contention happens. Use client libraries that retry 40001 (serialization failure) errors automatically.
Don't:
- Don't use
SELECT *without Limits: In a distributed DB, this might scatter-gather from 100 nodes. - Don't use Foreign Keys excessively: Cross-range FK checks can be expensive.