From ff01144e871b7eaa3b91a3054fa57c3dbbb19702 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 26 Dec 2019 09:28:20 +0000 Subject: Create an index for the hash component of derivation filenames This is to aid rendering of narinfo files. They're requested with the path /HASH.narinfo, so to quickly find the relevant derivation, this index can be used. --- sqitch/deploy/derivations_hash_index.sql | 7 +++++++ sqitch/revert/derivations_hash_index.sql | 7 +++++++ sqitch/sqitch.plan | 1 + sqitch/verify/derivations_hash_index.sql | 7 +++++++ 4 files changed, 22 insertions(+) create mode 100644 sqitch/deploy/derivations_hash_index.sql create mode 100644 sqitch/revert/derivations_hash_index.sql create mode 100644 sqitch/verify/derivations_hash_index.sql (limited to 'sqitch') diff --git a/sqitch/deploy/derivations_hash_index.sql b/sqitch/deploy/derivations_hash_index.sql new file mode 100644 index 0000000..869ff0a --- /dev/null +++ b/sqitch/deploy/derivations_hash_index.sql @@ -0,0 +1,7 @@ +-- Deploy guix-data-service:derivations_hash_index to pg + +BEGIN; + +CREATE INDEX derivations_hash ON derivations (substring(file_name from 12 for 32)); + +COMMIT; diff --git a/sqitch/revert/derivations_hash_index.sql b/sqitch/revert/derivations_hash_index.sql new file mode 100644 index 0000000..dbe773b --- /dev/null +++ b/sqitch/revert/derivations_hash_index.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:derivations_hash_index from pg + +BEGIN; + +DROP INDEX derivations_hash; + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index c047adf..5b5659c 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -38,3 +38,4 @@ sort_out_duplicate_builds 2019-12-05T12:43:53Z # Sort out duplic add_some_database_indexes 2019-12-05T15:53:04Z Christopher Baines # Add some indexes derivation_output_sets 2019-12-05T23:19:05Z Christopher Baines # Describe the sets of derivation outputs builds_add_derivation_output_details_set_id 2019-12-07T18:25:38Z Christopher Baines # Add a derivation_output_details_set_id column to builds +derivations_hash_index 2019-12-24T22:54:19Z Christopher Baines # Add index on derivations for the hash component of the filename diff --git a/sqitch/verify/derivations_hash_index.sql b/sqitch/verify/derivations_hash_index.sql new file mode 100644 index 0000000..2c6e6b7 --- /dev/null +++ b/sqitch/verify/derivations_hash_index.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:derivations_hash_index on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3