/blog/vault-as-database

Why I treat my vault like a database

2026-05-21 · 9 min · #zettelkasten #devops
hero diagram · 2:1

After 18 months and 1,318 notes, my Obsidian vault stopped being a “second brain” and started being something else: a flat-file database with foreign keys.

This isn’t a tutorial. It’s the moment the metaphor shifted, and the things I changed once it did.

1 · the problem

Every note-taking system eventually becomes a retrieval problem. You write a note. You write another. You forget the first one exists. The system that was supposed to make you smarter is now a pile you have to grep through.

I hit this wall around note 800.

2 · what the vault is now

A directory of ~/.vault with one file per note, a flat namespace, and frontmatter for every column you’d ever query on.

# note.md frontmatter
id: 202604180921
tags: [k8s, networking, eBPF]
refs: [[202603220812]], [[202602100731]]

Every note has an ID, tags, and references. Those three things, plus a vault-wide search, are the whole “database.”

3 · keys, indexes, joins

The ID is the primary key. Tags are a secondary index. refs are foreign keys — except they point to filenames, not row IDs.

ripgrep is the query engine. A join looks like:

rg --glob "*.md" "refs:.*202603220812"

That finds every note that references the note with ID 202603220812. That’s a JOIN.

4 · queries I actually run

# "what do I know about cilium?"
rg -l "cilium" ~/.vault | wc -l

# "what did I write about k8s networking in March 2026?"
rg --glob "*.md" -l "k8s" ~/.vault | xargs grep -l "networking" | xargs ls -lt | head -5

# "what are my most-referenced notes?"
rg --glob "*.md" -oh "refs:.*" ~/.vault | grep -oP '\[\[\K[^\]]+' | sort | uniq -c | sort -rn | head -10

None of this is fancy. All of it is fast.

5 · what I’d do again

  • Flat namespace. No folders. Tags are your index.
  • Numeric IDs based on timestamp. Unique, sortable, grep-able.
  • Backlinks via frontmatter refs. Obsidian shows them automatically.
  • One note per concept. Not one note per source.

6 · what I wouldn’t

  • Rely on Obsidian’s graph view as the primary interface. It looks beautiful. It tells you very little.
  • Use Dataview for anything you could just grep for. The abstraction cost is real.
  • Write notes longer than 300 words. Long notes are a smell that you haven’t atomized the concept yet.

The vault isn’t a second brain. It’s a database. Once I accepted that, I started querying it properly.