Skip to content

[Bug]: statement_info aggr_count aggregation is inconsistent #32308

Open

Description

@Ariznawlll

Bug

system.statement_info's aggregation of repeated executions of the same SQL is inconsistent and its aggr_count semantics are broken, making the table unreliable for slow-query/QPS analysis (the equivalent of MySQL's events_statements_summary_by_digest, where COUNT_STAR accumulates deterministically per digest).

Observations (same SQL executed 5 times, two different days)

Day 1 (slow point query, k2=600 over 1M-row table, 5 executions):

  • Only 2 rows recorded, with aggr_count = 5 and 2 respectively (5 executions split as 5+2 = 7?)
  • One row shows rows_read = 5,000,000 (accumulated across runs), the other 75,304 — neither matches per-statement nor per-aggregation semantics

Day 2 (join query scanning 2×9M rows, 5 successful executions, all >1s):

  • 5 rows recorded (no aggregation at all this time), aggr_count = 0 on every row
  • rows_read = 18,000,000 per row (accurate here)

Additional inconsistencies:

  • Fast statements (< threshold?) never appear at all (e.g. sub-second SELECT count(*) ... WHERE v > N ×5 left zero rows)
  • SELECT SLEEP(1) ×5 left zero rows
  • Records only surface after the async ETL (LOAD DATA INLINE ... INTO system.statement_info) runs, so "recent" queries are missing from the table

Impact

Any tooling built on statement_info (slow-query tops, per-digest QPS/latency stats) gets non-deterministic data: the same workload produces different row counts and contradictory aggr_count values depending on when/how aggregation fires.

Version

8.0.30-MatrixOne-v1.3.0 (standalone local cluster, macOS)

Activity

  1. added
    kind/bug
    on Nov 6, 2026
  2. added this to the MO-202611 milestone on Nov 6, 2026
  3. added theissue type on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions