Skip to content

feat(db): Postgres backend (khive-db-postgres) — SQL dialect + pgvector + pooling #558

@ohdearquant

Description

@ohdearquant

Part of #554 (multi-backend storage). ADR-009 already named khive-db-postgres as planned.

Why Postgres is the easy backend (and validates #555)

Postgres is SQL — it reuses the AST→SQL compiler path with a dialect fork, not a new query language. This is the concrete second consumer of #555's QueryCompiler strategy ("SQL dialects" plural in ADR-008). Dialect deltas vs SQLite:

  • Param placeholders: $1, $2 vs SQLite ?.
  • Recursive CTE: both WITH RECURSIVE, but type coercion + LIMIT semantics differ.
  • Upsert: INSERT ... ON CONFLICT (mostly compatible, watch partial-index targets).
  • Types: strict typing + jsonb (vs SQLite dynamic + json1) for entity properties.

Trait impls (khive-db-postgres crate, the 8 ADR-005 traits)

Concurrency

Postgres MVCC removes SQLite's single-writer (WAL) bottleneck — required for a hosted multi-writer khive.

Acceptance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions