Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Guix Cuirass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Panda
Guix Cuirass
Commits
f9a5dbd5
Unverified
Commit
f9a5dbd5
authored
3 years ago
by
Mathieu Othacehe
Browse files
Options
Downloads
Patches
Plain Diff
Put all indexes together.
* src/schema.sql: Put all indexes together.
parent
3df6e09e
No related branches found
Branches containing commit
Tags
0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/schema.sql
+12
-13
12 additions, 13 deletions
src/schema.sql
with
12 additions
and
13 deletions
src/schema.sql
+
12
−
13
View file @
f9a5dbd5
...
...
@@ -126,19 +126,6 @@ CREATE TABLE Dashboards (
FOREIGN
KEY
(
specification
)
REFERENCES
Specifications
(
name
)
ON
DELETE
CASCADE
);
-- XXX: All queries targeting Builds and Outputs tables *must* be covered by
-- an index. It is also preferable for the other tables.
CREATE
INDEX
Builds_status_index
ON
Builds
(
status
);
CREATE
INDEX
Builds_evaluation_index
ON
Builds
(
evaluation
,
status
);
CREATE
INDEX
Builds_job_name_timestamp
on
Builds
(
job_name
,
timestamp
);
CREATE
INDEX
Builds_nix_name
ON
Builds
(
nix_name
);
CREATE
INDEX
Builds_timestamp_stoptime
on
Builds
(
timestamp
,
stoptime
);
CREATE
INDEX
Builds_stoptime
on
Builds
(
stoptime
DESC
);
CREATE
INDEX
Builds_stoptime_id
on
Builds
(
stoptime
DESC
,
id
DESC
);
CREATE
INDEX
Builds_status_ts_id
on
Builds
(
status
DESC
,
timestamp
DESC
,
id
ASC
);
CREATE
INDEX
Builds_priority_timestamp
on
Builds
(
priority
ASC
,
timestamp
DESC
);
CREATE
INDEX
Builds_weather_evaluation
ON
Builds
(
weather
,
evaluation
);
-- Make sure that the cached Job build status is always synchronized with the
-- matching build status.
CREATE
FUNCTION
update_job_status
()
...
...
@@ -168,6 +155,18 @@ LEFT JOIN BuildDependencies as bd ON bd.source = Builds.id
LEFT
JOIN
Builds
AS
dep
ON
bd
.
target
=
dep
.
id
AND
dep
.
status
!=
0
WHERE
Builds
.
status
=
-
2
GROUP
BY
Builds
.
id
;
-- XXX: All queries targeting Builds and Outputs tables *must* be covered by
-- an index. It is also preferable for the other tables.
CREATE
INDEX
Builds_status_index
ON
Builds
(
status
);
CREATE
INDEX
Builds_evaluation_index
ON
Builds
(
evaluation
,
status
);
CREATE
INDEX
Builds_job_name_timestamp
on
Builds
(
job_name
,
timestamp
);
CREATE
INDEX
Builds_nix_name
ON
Builds
(
nix_name
);
CREATE
INDEX
Builds_timestamp_stoptime
on
Builds
(
timestamp
,
stoptime
);
CREATE
INDEX
Builds_stoptime
on
Builds
(
stoptime
DESC
);
CREATE
INDEX
Builds_stoptime_id
on
Builds
(
stoptime
DESC
,
id
DESC
);
CREATE
INDEX
Builds_status_ts_id
on
Builds
(
status
DESC
,
timestamp
DESC
,
id
ASC
);
CREATE
INDEX
Builds_priority_timestamp
on
Builds
(
priority
ASC
,
timestamp
DESC
);
CREATE
INDEX
Builds_weather_evaluation
ON
Builds
(
weather
,
evaluation
);
CREATE
INDEX
Jobs_name
ON
Jobs
(
name
);
CREATE
INDEX
Jobs_system_status
ON
Jobs
(
system
,
status
);
CREATE
INDEX
Jobs_build
ON
Jobs
(
build
);
--speeds up delete cascade.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment