Skip to content

fix(github): report table growth per table, capped - #209

Merged
veksen merged 1 commit into
mainfrom
fix-growth-tables-only
Jul 31, 2026
Merged

veksen merged 1 commit into
mainfrom
fix-growth-tables-only

Conversation

@veksen

@veksen veksen commented Jul 31, 2026

Copy link
Copy Markdown
Member

Goal

Make the growth line readable and true. Follow-up to #206, caught on its first live run.

What

Before, on Site#3775:

Bigger tables since the baseline: project_queries +80% (3,503 -> 6,290 rows), oauth_tokens +28%
(111 -> 142 rows), oauth_tokens_access_token_hash_idx +28% (111 -> 142 rows), oauth_tokens_pkey
+28% (111 -> 142 rows), oauth_tokens_refresh_token_hash_idx +28% (111 -> 142 rows), ...

14 entries for 4 tables. oauth_tokens_pkey is an index, and it reports the row count of the table it sits on, so every index on a grown table repeated that table's growth.

After:

Bigger tables since the baseline: project_queries +80% (3,503 -> 6,290 rows), oauth_tokens +28%
(111 -> 142 rows), sessions +25% (12 -> 15 rows), and 1 more. A plan costs more against more
rows, whatever the diff changed.

How

computedStats.reltuples has no relkind, so a relation cannot be classified from that payload alone. The run's statisticsMode.stats carries tableName for real tables, so main.ts builds a set from it and tableGrowth filters against it. Without the set the function keeps every relation, which is the behaviour a run planned on assumptions gets.

The template names the three biggest and counts the rest.

Tests

table-growth.test.ts covers dropping an index that mirrors its table, and keeping every relation when no table list is known. github.test.ts covers the cap. Full suite: 404 passing, 41 files, typecheck clean.

computedStats lists every relation, and an index reports the row count of the
table it sits on. So one table that grew was named once per index: the first
live run listed 14 bigger 'tables' for 4 that actually grew, including
oauth_tokens_pkey and sessions_expire_idx.

Filter to the table names the run's statisticsMode carries, and name the three
biggest with a count for the rest.

Co-Authored-By: Claude <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

 Query Doctor

6 successful checks

 Cost regression — No query went up more than 5%
 Untested data access — No changed data-access file without a test
 New query — No new queries
 New query with index recommendation — No new query ships an index recommendation
 Schema drift — No schema changes
 High-value nudge — No index or rewrite past the threshold


More details via MCP → get_ci_run({ runId: "019fb977-3751-7d49-bcc7-9d51455e51bb" }) · view run · docs
3 queries read against main on assumed statistics of 10,000,000 rows per table. Sync production stats for costs measured against your real data.

@veksen
veksen merged commit 43b12e3 into main Jul 31, 2026
6 checks passed
@veksen
veksen deleted the fix-growth-tables-only branch August 12, 2026 20:06
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.

1 participant