PostgreSQL's ltree extension gives you materialised paths with database-native superpowers: GiST indexes, specialised operators like @> and <@, and powerful pattern matching. If you're committed to...
Saturday, 06 December 2025 09:50
//
15 minute read
Nested sets encode the entire tree structure into just two integers per node - Left and Right boundaries from a depth-first walk. Finding all descendants becomes a simple range query, and ORDER BY...
Saturday, 06 December 2025 09:40
//
16 minute read
Materialised paths store the complete ancestry as a delimited string - like /1/3/7/ - making ancestors instantly readable without any joins. Perfect for breadcrumb generation and human-readable...
Saturday, 06 December 2025 09:30
//
14 minute read
Closure tables precompute and store every ancestor-descendant relationship, trading storage space for blazing-fast reads. This is the approach this blog uses for its comment system - when reads vastly...
Saturday, 06 December 2025 09:20
//
16 minute read
The adjacency list is the simplest and most intuitive approach to storing hierarchical data - each row just points to its parent. It's what most developers reach for first, and for shallow trees with...
Saturday, 06 December 2025 09:10
//
11 minute read