Skip to content

coord: remove O(n) table advancement loop from group_commit#36474

Merged
aljoscha merged 1 commit into
MaterializeInc:mainfrom
aljoscha:push-xpsxkrrplkoo
May 21, 2026
Merged

coord: remove O(n) table advancement loop from group_commit#36474
aljoscha merged 1 commit into
MaterializeInc:mainfrom
aljoscha:push-xpsxkrrplkoo

Conversation

@aljoscha
Copy link
Copy Markdown
Contributor

@aljoscha aljoscha commented May 8, 2026

Remove the loop in group_commit() that iterated ALL catalog entries on every group commit to add empty advancement entries for every table. With ~20k+ tables, this was the dominant DDL bottleneck at ~23% of DDL time.

The txn-wal protocol makes explicit per-table advancement unnecessary: when any transaction commits to the txns shard, the logical upper of ALL registered data shards advances automatically, including those not involved in the transaction. The empty advancement entries were performing no useful work on the storage side.

Also removed the early-return optimization in PersistTableWriteWorker::append that skipped the txn-wal commit for empty updates. This ensures periodic group commits (with no actual data writes) still advance the txns shard upper, maintaining the property that table logical uppers advance even when no writes are happening.

Results at ~28k objects (optimized build):

  • CREATE TABLE: 374ms → 131ms (65% faster)
  • CREATE VIEW: ~96ms
  • DROP TABLE: ~97ms
  • DROP VIEW: ~86ms

Remove the loop in `group_commit()` that iterated ALL catalog entries on
every group commit to add empty advancement entries for every table. With
~20k+ tables, this was the dominant DDL bottleneck at ~23% of DDL time.

The txn-wal protocol makes explicit per-table advancement unnecessary:
when any transaction commits to the txns shard, the logical upper of ALL
registered data shards advances automatically, including those not involved
in the transaction. The empty advancement entries were performing no useful
work on the storage side.

Also removed the early-return optimization in PersistTableWriteWorker::append
that skipped the txn-wal commit for empty updates. This ensures periodic
group commits (with no actual data writes) still advance the txns shard
upper, maintaining the property that table logical uppers advance even when
no writes are happening.

Results at ~28k objects (optimized build):
- CREATE TABLE: 374ms → 131ms (65% faster)
- CREATE VIEW: ~96ms
- DROP TABLE: ~97ms
- DROP VIEW: ~86ms

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aljoscha aljoscha force-pushed the push-xpsxkrrplkoo branch from 5d4848b to b398662 Compare May 12, 2026 19:03
@aljoscha aljoscha marked this pull request as ready for review May 13, 2026 14:02
@aljoscha aljoscha requested review from a team as code owners May 13, 2026 14:02
Copy link
Copy Markdown
Contributor

@ggevay ggevay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@aljoscha aljoscha merged commit 967672a into MaterializeInc:main May 21, 2026
342 checks passed
@aljoscha aljoscha deleted the push-xpsxkrrplkoo branch May 21, 2026 14:50
antiguru pushed a commit to antiguru/materialize that referenced this pull request May 25, 2026
…izeInc#36474)

Remove the loop in `group_commit()` that iterated ALL catalog entries on
every group commit to add empty advancement entries for every table.
With ~20k+ tables, this was the dominant DDL bottleneck at ~23% of DDL
time.

The txn-wal protocol makes explicit per-table advancement unnecessary:
when any transaction commits to the txns shard, the logical upper of ALL
registered data shards advances automatically, including those not
involved in the transaction. The empty advancement entries were
performing no useful work on the storage side.

Also removed the early-return optimization in
PersistTableWriteWorker::append that skipped the txn-wal commit for
empty updates. This ensures periodic group commits (with no actual data
writes) still advance the txns shard upper, maintaining the property
that table logical uppers advance even when no writes are happening.

Results at ~28k objects (optimized build):
- CREATE TABLE: 374ms → 131ms (65% faster)
- CREATE VIEW: ~96ms
- DROP TABLE: ~97ms
- DROP VIEW: ~86ms

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants