Skip to content

Commit

Permalink
add WITHOUT ROWID to all tables
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Jul 29, 2024
1 parent c0a4b65 commit 8cf3d1a
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions migrations/01-init/up.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
-- See `src/report/models.rs` for complete, up-to-date schema documentation.

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE source_file (
-- This should be set to the hash of the `path` column so that we can
-- distribute processing across multiple different hosts and they will
-- all come up with the same ID.
id INTEGER PRIMARY KEY,

path VARCHAR NOT NULL
);
) WITHOUT ROWID;

-- TODO: Allow distinguishing between raw reports within a single upload
-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE raw_upload (
-- This should be set to a random 64-bit integer so that we can
-- distribute processing across multiple different hosts and they will
Expand All @@ -30,9 +28,8 @@ CREATE TABLE raw_upload (
env VARCHAR,
session_type VARCHAR,
session_extras VARCHAR -- JSON,
);
) WITHOUT ROWID;

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE context (
-- This should be set to the hash of the `name` column so that we can
-- distribute processing across multiple different hosts and they will
Expand All @@ -41,9 +38,8 @@ CREATE TABLE context (

context_type VARCHAR NOT NULL,
name VARCHAR NOT NULL
);
) WITHOUT ROWID;

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE context_assoc (
context_id INTEGER REFERENCES context(id) NOT NULL,

Expand All @@ -55,10 +51,9 @@ CREATE TABLE context_assoc (
-- FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
-- FOREIGN KEY (raw_upload_id, local_span_id) REFERENCES span_data(raw_upload_id, local_span_id),

PRIMARY KEY (context_id, raw_upload_id, local_sample_id, local_span_id)
);
PRIMARY KEY (context_id, raw_upload_id, local_sample_id)
) WITHOUT ROWID;

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE coverage_sample (
raw_upload_id INTEGER REFERENCES raw_upload(id) NOT NULL,

Expand All @@ -74,9 +69,8 @@ CREATE TABLE coverage_sample (
total_branches INTEGER,

PRIMARY KEY (raw_upload_id, local_sample_id)
);
) WITHOUT ROWID;

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE branches_data (
raw_upload_id INTEGER REFERENCES raw_upload(id) NOT NULL,
local_sample_id INTEGER NOT NULL,
Expand All @@ -92,9 +86,8 @@ CREATE TABLE branches_data (

FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
PRIMARY KEY (raw_upload_id, local_branch_id)
);
) WITHOUT ROWID;

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE method_data (
raw_upload_id INTEGER REFERENCES raw_upload(id) NOT NULL,
local_sample_id INTEGER NOT NULL,
Expand All @@ -112,9 +105,8 @@ CREATE TABLE method_data (

FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
PRIMARY KEY (raw_upload_id, local_method_id)
);
) WITHOUT ROWID;

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE span_data (
raw_upload_id INTEGER REFERENCES raw_upload(id) NOT NULL,
local_sample_id INTEGER,
Expand All @@ -132,4 +124,4 @@ CREATE TABLE span_data (

FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
PRIMARY KEY (raw_upload_id, local_span_id)
);
) WITHOUT ROWID;

0 comments on commit 8cf3d1a

Please sign in to comment.