Chuyển đến nội dung
Skillpedia
Cơ sở dữ liệu48k · #5310

nosql-expert

Skill này làm gì

Agent này giúp thiết kế cơ sở dữ liệu NoSQL phân tán như Cassandra và DynamoDB. Nó tập trung vào việc tổ chức dữ liệu dựa trên các câu hỏi bạn sẽ đặt ra, thay vì cách làm trong cơ sở dữ liệu truyền thống.

Khi nào nên dùng

  • ✓Khi lên kế hoạch cho một hệ thống cần xử lý nhiều dữ liệu và người dùng.
  • ✓Khi chọn giữa các loại cơ sở dữ liệu NoSQL khác nhau.
  • ✓Khi cần khắc phục tình trạng chậm trong cơ sở dữ liệu NoSQL hiện có.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/nosql-expert/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/nosql-expert/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi cần giúp thiết kế một bảng DynamoDB để lưu thông tin người dùng và đơn hàng của họ, tập trung vào việc tra cứu nhanh theo ID người dùng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent dạy bạn nghĩ về các truy vấn sẽ thực hiện trước. Sau đó, nó tổ chức dữ liệu sao cho các truy vấn đó nhanh nhất có thể, ngay cả khi điều đó nghĩa là phải lặp lại một số thông tin.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

NoSQL Expert Patterns (Cassandra & DynamoDB)

Overview

This skill provides professional mental models and design patterns for distributed wide-column and key-value stores (specifically Apache Cassandra and Amazon DynamoDB).

Unlike SQL (where you model data entities), or document stores (like MongoDB), these distributed systems require you to model your queries first.

When to Use

  • Designing for Scale: Moving beyond simple single-node databases to distributed clusters.
  • Technology Selection: Evaluating or using Cassandra, ScyllaDB, or DynamoDB.
  • Performance Tuning: Troubleshooting "hot partitions" or high latency in existing NoSQL systems.
  • Microservices: Implementing "database-per-service" patterns where highly optimized reads are required.

The Mental Shift: SQL vs. Distributed NoSQL

Feature SQL (Relational) Distributed NoSQL (Cassandra/DynamoDB)
Data modeling Model Entities + Relationships Model Queries (Access Patterns)
Joins CPU-intensive, at read time Pre-computed (Denormalized) at write time
Storage cost Expensive (minimize duplication) Cheap (duplicate data for read speed)
Consistency ACID (Strong) BASE (Eventual) / Tunable
Scalability Vertical (Bigger machine) Horizontal (More nodes/shards)

The Golden Rule: In SQL, you design the data model to answer any query. In NoSQL, you design the data model to answer specific queries efficiently.

Core Design Patterns

1. Query-First Modeling (Access Patterns)

You typically cannot "add a query later" without migration or creating a new table/index.

Process:

  1. List all Entities (User, Order, Product).
  2. List all Access Patterns ("Get User by Email", "Get Orders by User sorted by Date").
  3. Design Table(s) specifically to serve those patterns with a single lookup.

2. The Partition Key is King

Data is distributed across physical nodes based on the Partition Key (PK).

  • Goal: Even distribution of data and traffic.
  • Anti-Pattern: Using a low-cardinality PK (e.g., status="active" or gender="m") creates Hot Partitions, limiting throughput to a single node's capacity.
  • Best Practice: Use high-cardinality keys (User IDs, Device IDs, Composite Keys).

3. Clustering / Sort Keys

Within a partition, data is sorted on disk by the Clustering Key (Cassandra) or Sort Key (DynamoDB).

  • This allows for efficient Range Queries (e.g., WHERE user_id=X AND date > Y).
  • It effectively pre-sorts your data for specific retrieval requirements.

4. Single-Table Design (Adjacency Lists)

Primary use: DynamoDB (but concepts apply elsewhere)

Storing multiple entity types in one table to enable pre-joined reads.

PK (Partition) SK (Sort) Data Fields...
USER#123 PROFILE { name: "Ian", email: "..." }
USER#123 ORDER#998 { total: 50.00, status: "shipped" }
USER#123 ORDER#999 { total: 12.00, status: "pending" }
  • Query: PK="USER#123"
  • Result: Fetches User Profile AND all Orders in one network request.

5. Denormalization & Duplication

Don't be afraid to store the same data in multiple tables to serve different query patterns.

  • Table A: users_by_id (PK: uuid)
  • Table B: users_by_email (PK: email)

Trade-off: You must manage data consistency across tables (often using eventual consistency or batch writes).

Specific Guidance

Apache Cassandra / ScyllaDB

  • Primary Key Structure: ((Partition Key), Clustering Columns)
  • No Joins, No Aggregates: Do not try to JOIN or GROUP BY. Pre-calculate aggregates in a separate counter table.
  • Avoid ALLOW FILTERING: If you see this in production, your data model is wrong. It implies a full cluster scan.
  • Writes are Cheap: Inserts and Updates are just appends to the LSM tree. Don't worry about write volume as much as read efficiency.
  • Tombstones: Deletes are expensive markers. Avoid high-velocity delete patterns (like queues) in standard tables.

AWS DynamoDB

  • GSI (Global Secondary Index): Use GSIs to create alternative views of your data (e.g., "Search Orders by Date" instead of by User).
    • Note: GSIs are eventually consistent.

…

Câu hỏi thường gặp

Khác biệt chính giữa SQL và NoSQL cho người mới là gì?

Trong SQL, bạn tổ chức dữ liệu thành bảng có quan hệ rồi đặt bất kỳ câu hỏi nào. Trong NoSQL (như Cassandra/DynamoDB), bạn tổ chức dữ liệu theo những câu hỏi cụ thể sẽ đặt ra, nên câu trả lời rất nhanh.

“Hot partition” là gì?

Đó là khi quá nhiều dữ liệu hoặc truy cập tập trung vào một điểm của cơ sở dữ liệu, tạo ra nút thắt cổ chai và làm hệ thống chậm. Mục tiêu là phân bố đều mọi thứ.

Tôi có thể dùng agent này cho MongoDB không?

Agent này tập trung vào cơ sở dữ liệu NoSQL dạng wide-column và key-value như Cassandra và DynamoDB. MongoDB thuộc loại khác (document) và có thể cần cách tiếp cận khác.

Chi tiết

Mô tả gốc của tác giả

Expert guidance for distributed NoSQL databases (Cassandra, DynamoDB). Focuses on mental models, query-first modeling, single-table design, and avoiding hot partitions in high-scale systems.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5310
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự