Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/backend/db/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ CREATE TABLE Measurement (

values float4[] NOT NULL,

primary key (invocation, runId, trialId, criterion),
primary key (runId, trialId, criterion, invocation),
foreign key (trialId) references Trial (id),
foreign key (runId) references Run (id),
foreign key (criterion) references Criterion (id)
Expand All @@ -171,7 +171,7 @@ CREATE TABLE ProfileData (

value text NOT NULL,

primary key (numIterations, invocation, runId, trialId),
primary key (runId, trialId, numIterations, invocation),
foreign key (trialId) references Trial (id),
foreign key (runId) references Run (id)
);
Expand Down
9 changes: 9 additions & 0 deletions src/backend/db/schema-updates/migration.015.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- The PK is wrongly ordered and makes queries for getting measurements very slow
-- because we end up scanning through all of the table.
ALTER TABLE Measurement
DROP CONSTRAINT measurement_pkey,
ADD CONSTRAINT measurement_pkey PRIMARY KEY (runid, trialid, criterion, invocation);

ALTER TABLE ProfileData
DROP CONSTRAINT profiledata_pkey,
ADD CONSTRAINT profiledata_pkey PRIMARY KEY (runid, trialid, numiterations, invocation);
Loading