Add YAML frontmatter to all 54 retained markdown documents. Frontmatter schema is type-specific — no universal status field. Type contracts applied: - knowledge: type + status (draft|stable) + topics - project: type + status (planned|active|paused|completed) - plan: type + status + project context - guide: type + project context (no lifecycle status) - journal: type + date (no status — journals are historical by definition) - practice: type + status (completed|active) + topics - inbox: type + created date 54 documents tagged across: knowledge/concepts/ (3) knowledge/technologies/ (7, including python/ subdirectory with 4) knowledge/methods/ (6) projects/homelab/ (1 overview + 6 plans + 6 guides) projects/magnetflix/ (1) projects/nekoweb/ (1) records/journal/ (7) practice/LeetCode/ (14) inbox/ (1)
23 lines
989 B
Markdown
23 lines
989 B
Markdown
---
|
|
type: knowledge
|
|
status: draft
|
|
topics: ['sql', 'postgresql']
|
|
---
|
|
|
|
# SQL & Relational Databases Notes
|
|
|
|
## ACID Properties
|
|
- **Atomicity:** All operations in a transaction succeed or all fail.
|
|
- **Consistency:** Database transitions from one valid state to another.
|
|
- **Isolation:** Concurrent transactions don't interfere with each other.
|
|
- **Durability:** Once committed, changes survive system failures.
|
|
|
|
## Indexes
|
|
- An index speeds up data retrieval operations (SELECT) at the cost of slower writes (INSERT, UPDATE, DELETE) and extra storage.
|
|
- **When to use:** Columns frequently queried in `WHERE` clauses, JOIN keys.
|
|
- **When NOT to use:** Columns with low cardinality (e.g. booleans), tables with very few rows, columns frequently updated.
|
|
|
|
## Joins
|
|
- **INNER JOIN:** Returns records with matching values in both tables.
|
|
- **LEFT JOIN (or LEFT OUTER JOIN):** Returns all records from the left table, and matching records from the right. If no match, right-side columns are NULL.
|