Skip to content

Phase 3: Advanced Query Features — OR Disjunction, Navigation Joins, Advanced Statistics #141

Closed

Description

@nockawa

Goal

Extend the query/view system with L3 (OR disjunction) and L4 (navigation join) predicate support, and introduce advanced statistics (HLL, MCV) for improved selectivity estimation on skewed data distributions.

Dependencies

  • Depends on: Tier 7: Query System #60 (Tier 7 — Query System) ✅ Complete
  • Builds on: Phase 2 query planning stack (PlanBuilder, PipelineExecutor, SelectivityEstimator, ExecutionPlan caching)

Design Reference

Sub-Issues

All three are independent — can be worked in any order or in parallel.

Key Architecture Decisions

Decision Choice Rationale
OR representation DNF (max 16 clauses) Branch bitmap fits in ushort, bounded memory
OR membership Per-entity branch bitmap (Dictionary<long, ushort>) O(1) check if any branch satisfied
Navigation entity set Source PKs (Player) not target PKs (Guild) Game code iterates source entities
HLL maintenance Rebuild every ~1000 commits (async) HLL has no Remove — incremental accumulates ghost values
MCV + HLL scan Single shared O(N) leaf scan Amortized cost, zero commit-path overhead

Acceptance Criteria

  • Views support || in predicates with correct incremental refresh
  • Views support p.GuildId == g.Id navigation patterns
  • SelectivityEstimator uses MCV/HLL when available, degrades gracefully
  • Zero additional per-commit overhead (counter increment only)
  • All existing tests continue to pass (no regression)

Activity

  1. moved this to Backlog in Typhon devon Mar 9, 2026
  2. moved this from Backlog to In Progress in Typhon devon Mar 9, 2026
  3. moved this from In Progress to Done in Typhon devon Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions