Inkdown
Start writing

Study

70 filesยท12 subfolders

Shared Workspace

Study
AI eng

06-nosql-databases

Shared from "Study" on Inkdown

06 - NoSQL Databases

Why NoSQL?

While relational databases excel at structured data and complex relationships, they face challenges with:

  • Massive scale (billions of rows)
  • Flexible schemas (data structure varies)
  • High velocity writes (IoT, logs, events)
  • Geographic distribution (low latency worldwide)
  • Unstructured/semi-structured data (documents, graphs)

NoSQL Categories

Plain text
basic-ques
core
Revision w/ Whiteboard
CN Basics - 1
CN Basics - 2
DNS
Event loop
programming-language-concepts.md
zero-language-explanation.md
DB
Quick
databases-deep-dive.md
01-introduction.md
02-relational-databases.md
03-database-design.md
04-indexing.md
05-transactions-acid.md
06-nosql-databases.md
07-query-optimization.md
08-replication-ha.md
09-sharding-partitioning.md
10-caching-strategies.md
11-cap-theorem.md
12-connection-pooling.md
13-backup-recovery.md
14-monitoring.md
15-database-selection.md
README.md
JS
core topics
Event loop
Merlin Backend
01-Orchestration.md
02-DeepResearch.md
03-Search.md
04-Scraping.md
05-Streaming.md
06-MultiProviderLLM.md
07-MemoryAndContext.md
08-ErrorHandling.md
09-RateLimiting.md
10-TaskQueue.md
11-SecurityAndAuth.md
Orchestration-2nd-draft
Mobile
Build Alternative
Bundling
metro-bundler-deep-dive.md
OpenAI Agents Python
00_OVERVIEW.md
01_AGENT_SYSTEM.md
02_RUNNER_SYSTEM.md
03_TOOL_SYSTEM.md
04_ITEMS_SYSTEM.md
05_GUARDRAILS.md
06_HANDOFFS.md
07_MEMORY_SESSIONS.md
08_MODEL_PROVIDERS.md
09_SANDBOX_SYSTEM.md
10_TRACING.md
11_RUN_STATE.md
12_CONTEXT.md
13_LIFECYCLE_HOOKS.md
14_CONFIGURATION.md
15_ERROR_HANDLING.md
16_STREAMING.md
17_EXTENSIONS.md
18_MCP_INTEGRATION.md
19_BEST_PRACTICES.md
20_ARCHITECTURE_PATTERNS.md
opencode-study
context-handling
core
Python
Alembic
Basics
sqlalchemy - fastapi
SQLAlchemy overview
tweets
system_design_for_agentic_apps.md
Agent Loop

1. Document Databases

Concept

Store data as self-contained documents (usually JSON), with flexible schemas.

JavaScript
When to Use
  • Data has nested structure
  • Schema evolves frequently
  • Read-heavy with few joins
  • Content management, catalogs, user profiles
MongoDB Query Examples
JavaScript
Schema Design Patterns
JavaScript

2. Key-Value Stores

Concept

Simplest data model: key โ†’ value. Lightning fast, highly scalable.

Plain text
Redis Examples
Bash
Use Cases
  • Caching: Session storage, page cache, query results
  • Rate Limiting: Sliding window counters
  • Real-time: Leaderboards, live updates
  • Queues: Task queues, message passing
  • Pub/Sub: Real-time notifications

3. Wide-Column Stores (Column-Family)

Concept

Store data in columns rather than rows. Excellent for massive scale and high throughput.

Plain text
Cassandra Data Model
Sql
Cassandra Principles
  1. Query-first design: Create tables for each query pattern
  2. Denormalize: Data duplication is OK for read performance
  3. Partition key: Determines which node stores data
  4. Clustering columns: Sort order within partition
  5. No JOINs: Application handles relationships

4. Graph Databases

Concept

Store entities (nodes) and relationships (edges) as first-class citizens.

Plain text
Neo4j Cypher Query Language
Cypher
When to Use Graph DB
  • Social networks: Friend recommendations, influence analysis
  • Fraud detection: Transaction patterns, ring detection
  • Recommendation engines: "People who bought X also bought Y"
  • Network/IT operations: Dependency analysis, impact analysis
  • Knowledge graphs: Entity relationships, semantic search

5. Time-Series Databases

Concept

Optimized for time-stamped data: metrics, events, IoT sensor readings.

Plain text
InfluxDB Example
Sql

NoSQL vs SQL: When to Choose

Plain text

Polyglot Persistence

Modern architectures often use multiple databases:

Plain text

Next: Query Optimization