Skip to content

Feature request: table scoping for optimize (--table / --exclude-table) #432

Description

@FlorianSeemann

Feature request: table scoping for optimize (--table / --exclude-table)

Problem

omnigraph optimize visits every node + edge table. When one table is operationally
un-compactable — in our case a blob-bearing File table (~151 GB of document blobs; since the
Lance 9.0.0-beta.15 bump removed the blob-compaction skip, optimize rewrites it) — the whole
maintenance sweep becomes unrunnable inside any reasonable operator window:

  • every scheduled run dies at its timeout mid-File-rewrite, restarting that table's compaction
    from scratch on the next tick, and
  • crucially, index-coverage maintenance for every other table dies with it. In production
    that meant fragments appended to a 751k-row vector table (Chunk, 3072-dim @embed +
    @index ANN) were never folded into the index. Reads stayed correct via the planner's
    brute-force flat-scan union branch, but each semantic query then pulled ~10.5 GB of raw
    vectors from object storage (~60 s per query; two concurrent queries OOM'd a 24 GB host).

The blob rewrite is also a storage-headroom hazard: compaction keeps old versions reachable
until cleanup, so an unscoped run transiently near-doubles the largest table in the bucket.

Proposal

Let the operator scope the sweep:

omnigraph optimize --exclude-table File s3://…            # everything except the blob table
omnigraph optimize --table Chunk --table ChunkOfArtifact s3://…   # just these two
  • Names resolve against the catalog as node:<Type> / edge:<Type> or a bare type name
    matching either; an unknown name errors (fail closed — a typo must not silently change the
    sweep), as does a scope that selects nothing.
  • Scoped runs keep the exact same per-table machinery (write gates, recovery sidecar, manifest
    publish); they just visit fewer tables.
  • The internal __manifest compaction still runs regardless of scope (cheap, in-place,
    content-preserving — and skipping it would let per-write metadata scans grow whenever the
    operator is forced to run scoped).

Patch

We are running this in production as a minimal patch on top of v0.8.1:
https://github.com/FlorianSeemann/omnigraph/tree/p9/v0.8.1-optimize-table-scope
(OptimizeScope { include, exclude } + optimize_tables_scoped in
db/omnigraph/optimize.rs, CLI flags, and four tests in tests/maintenance.rs including a
scoped-reindex coverage test). Happy to port it onto main's reworked optimize (the graph-wide
envelope) as a PR if you want the feature — the selection logic is independent of the publish
model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions