aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-05-17 18:40:45 +0100
committerChristopher Baines <mail@cbaines.net>2021-05-17 18:40:45 +0100
commitf4a87ec059519aefe6158b34049219542d03a22a (patch)
tree2c25445d66b02bb133797950281cb320a4093e95
parentb8bfdcf622a00264936a952932296bc4f13bdf37 (diff)
downloaddata-service-f4a87ec059519aefe6158b34049219542d03a22a.tar
data-service-f4a87ec059519aefe6158b34049219542d03a22a.tar.gz
Add some indexes
This is from reading the slow query log on data.guix.gnu.org.
-rw-r--r--sqitch/deploy/some_indexes.sql13
-rw-r--r--sqitch/revert/some_indexes.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/some_indexes.sql7
4 files changed, 28 insertions, 0 deletions
diff --git a/sqitch/deploy/some_indexes.sql b/sqitch/deploy/some_indexes.sql
new file mode 100644
index 0000000..d07edbf
--- /dev/null
+++ b/sqitch/deploy/some_indexes.sql
@@ -0,0 +1,13 @@
+-- Deploy guix-data-service:some_indexes to pg
+
+BEGIN;
+
+CREATE INDEX nar_urls_nar_id ON nar_urls (nar_id);
+
+CREATE INDEX load_new_guix_revision_jobs_unprocessed
+ ON load_new_guix_revision_jobs (id) WHERE succeeded_at IS NULL;
+
+CREATE INDEX guix_revision_lint_warnings_guix_revision_id
+ ON guix_revision_lint_warnings (guix_revision_id);
+
+COMMIT;
diff --git a/sqitch/revert/some_indexes.sql b/sqitch/revert/some_indexes.sql
new file mode 100644
index 0000000..7756dea
--- /dev/null
+++ b/sqitch/revert/some_indexes.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:some_indexes from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index 76d574b..4b969ad 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -79,3 +79,4 @@ guix_revision_package_derivations_add_package_derivation_index 2020-10-27T16:58:
increase_derivation_inputs_statistics_targets 2020-12-27T10:34:58Z Christopher Baines <mail@cbaines.net> # Increase stats targets on derivation_inputs fields
remove_guix_revisions_store_path 2021-02-02T20:06:18Z Christopher Baines <mail@cbaines.net> # Drop guix_revisions.store_path
systems_table 2021-04-22T08:12:10Z Christopher Baines <mail@cbaines.net> # Add a systems table
+some_indexes 2021-05-17T17:36:38Z Christopher Baines <mail@cbaines.net> # Add some indexes
diff --git a/sqitch/verify/some_indexes.sql b/sqitch/verify/some_indexes.sql
new file mode 100644
index 0000000..617411e
--- /dev/null
+++ b/sqitch/verify/some_indexes.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:some_indexes on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;