Skip to content

True declarative table partitioning for nodes/edges (current vs historical) — deferred from #385 #418

Description

@CheeryProgrammer

Deferred from #385. kb compact (VACUUM ANALYZE + current/historical report) shipped as the safe interim bloat tool; this tracks the real table-partitioning rewrite, to revisit only when the historical tail is genuinely large (10M+ superseded rows).

Why deferred

  • The real risk is correctness, not data size: converting a populated table to declarative partitioning is a rewrite (create partitioned table → copy → swap) that must faithfully recreate every index, unique constraint, and FK. A partitioned table also forces the partition key into every unique indexnodes_identity_current_uniq (scope_key, canonical_name) WHERE status='current' and edges_current_uniq need rework, and edges' from_id/to_id FKs to a partitioned nodes need re-establishing.
  • Partitioning + current-only partial indexes + superseded_at index #230's current-tier partial indexes already keep the hot path small regardless of historical depth, so the practical benefit at current scale is marginal.
  • Supersession flips status current→historical, which would move rows across partitions on every update (supported since PG 11, but with overhead).

Scope when picked up

Meanwhile

kb compact reclaims superseded-row bloat safely (non-blocking VACUUM ANALYZE). Run it after kb sweep-retention.

P2, area:scale.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority 2area:scaleData model & scalingtype:researchSpike / investigation before implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions