8000 perf(query): proved Sort omission, one-group count and partition windows · Issue #641 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf(query): proved Sort omission, one-group count and partition windows #641

Closed

Description

@adityamukho

Delivered in v3.0.0 development

The approved #641 plan was delivered in three dependent core PRs: #778 (snapshot-bound input-order proof and safe Sort omission), #779 (one-group built-in count/count-distinct), and #780 (partition-at-a-time built-in windows). Companion docs PRs are #80, #81, and #82. All six PRs are merged.

  • A top-level plain query can omit a final Sort only when its pinned committed source proves the complete ascending result order for supported scalar kinds. Other access paths and order-changing operators keep Sort/top-k.
  • A top-level plain grouped query can release one completed group at a time when it has exactly one proved scalar grouping key (integer, Boolean, canonical committed float, or mixed integer/float), no :with or windows, no user callback or collect-set anywhere in its pipeline, and only built-in count/count-distinct. Entity, keyword and string groups retain full-input evaluation. It holds the current group's state plus bounded batches; a single large distinct group can still grow.
  • Compatible built-in windows sharing one proved nonconstant partition key can release completed partitions. Unpartitioned, incompatible, callback, collect-set and aggregate-query windows keep full-input evaluation.

The proofs use the query's pinned snapshot and reject pending/staged records in the relevant source range. DICT order can prove partition adjacency but does not replace semantic Sort or Aggregate order. Rule queries and nested not/or bodies are unchanged. Answers, aggregate data errors and callback behavior are preserved. As with other streaming operators, a cursor may receive rows before a later I/O/allocation error, and Limit may leave unread input unvalidated.

Follow-up boundary

Generalizing one-group Aggregate to other ordinary built-ins, Value::Ord-ordered composite keys and :with is tracked in #781; considering avg there depends on #777 adding ordinary avg first. Callback, collect-set, aggregate+window and rule-query fallbacks remain outside that optimization. This issue records the delivered, conservative optimization; it does not claim every grouped aggregate streams.

Background: deferred from #547 and part of #473's streaming-engine design. The index/value comparator distinction in the original issue remains a requirement for follow-up work.

Activity

  1. added this to the v3.1.0 milestone on Oct 20, 2026
  2. added
    enhancementNew feature or request
    rustPull requests that update rust code
    performanceBenchmark performance regressions
    on Oct 20, 2026
  3. modified the milestones: v3.next, v3.0.0 on Oct 26, 2026
  4. added 3 commits that reference this issue on Oct 28, 2026
  5. changed the title [-]Streaming engine: skip Sort on index order, sort-grouped Aggregate[/-] [+]perf(query): proved Sort omission, one-group count and partition windows[/+] on Oct 28, 2026
  6. adityamukho commented on Oct 28, 2026

    @adityamukho
    CollaboratorAuthor

    Closed after core PRs #778, #779 and #780 and docs PRs project-minigraf/minigraf-docs#80, #81 and #82 merged. The delivered scope is recorded above. Remaining ordered Aggregate generalization is tracked in #781; its ordinary avg portion depends on #777.

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

    enhancementNew feature or requestperformanceBenchmark performance regressionsrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0