Skip to content

Commit f21050f

Browse files
authored
Merge pull request #1162 from oasisprotocol/ptrus/bugfix/speedup-migration
migrations: Speedup migration 49
2 parents 1a4fb09 + 4376369 commit f21050f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changelog/1162.trivial.md

Whitespace-only changes.
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
BEGIN;
22

3-
ALTER TABLE chain.transactions ADD COLUMN gas_used UINT_NUMERIC;
4-
ALTER TABLE chain.blocks
5-
ADD COLUMN size UINT_NUMERIC,
6-
ADD COLUMN gas_used UINT_NUMERIC;
3+
-- NOTE: We intentionally use NUMERIC(1000,0) instead of the uint_numeric domain.
4+
-- Adding a domain-typed column on these large tables caused a table rewrite
5+
-- (DataFileRead for hours) due to domain constraint plumbing being applied to
6+
-- every partition/chunk. Using the base type + NULLable column avoids the rewrite
7+
-- and is metadata-only (fast).
8+
ALTER TABLE chain.transactions ADD COLUMN gas_used NUMERIC(1000,0) NULL;
9+
10+
ALTER TABLE chain.blocks ADD COLUMN size NUMERIC(1000,0) NULL;
11+
ALTER TABLE chain.blocks ADD COLUMN gas_used NUMERIC(1000,0) NULL;
712

813
COMMIT;

0 commit comments

Comments
 (0)