docs: partitioning runbook for high-volume tables#50
Merged
Conversation
Tier 3 partitioning lands as a runbook + DDL templates rather than an
auto-migration. Three reasons:
1. Partition migration locks the table for the duration of INSERT
SELECT — on a 50M+ row table that's minutes-to-tens-of-minutes
of read-only window. Auto-running on container boot would block
every consumer for that whole time without warning.
2. The trigger thresholds (50M / 100M rows, p95 latency >200ms,
autovacuum lag) need operator judgement, not a hardcoded check.
3. Drizzle doesn't model PARTITION BY declaratively, so the schema
migration would have to be raw SQL anyway. Cleaner to keep the
SQL in docs where it can be reviewed step-by-step.
Strategy: range-partition by block_height, 1M blocks per partition
(~11.5 days at 1s blocks). Includes per-table recipe, weekly
partition-extender SQL, rollback procedure, and Drizzle
compatibility notes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tier 3 partitioning lands as a runbook + DDL templates rather than an auto-migration. Three reasons:
Strategy
Range-partition by `block_height`, 1M blocks per partition (~11.5 days at 1s blocks). Affected tables:
`addresses` and `blocks` stay non-partitioned (bounded sizes).
What lands
`docs/PARTITIONING.md` — full runbook including:
Test plan