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.
This commit is contained in:
Christopher Baines 2019-12-26 09:28:20 +00:00
parent a8d58e0541
commit ff01144e87
4 changed files with 22 additions and 0 deletions

View File

@ -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;

View File

@ -0,0 +1,7 @@
-- Revert guix-data-service:derivations_hash_index from pg
BEGIN;
DROP INDEX derivations_hash;
COMMIT;

View File

@ -38,3 +38,4 @@ sort_out_duplicate_builds 2019-12-05T12:43:53Z <chris@phact> # Sort out duplic
add_some_database_indexes 2019-12-05T15:53:04Z Christopher Baines <mail@cbaines.net> # Add some indexes
derivation_output_sets 2019-12-05T23:19:05Z Christopher Baines <mail@cbaines.net> # Describe the sets of derivation outputs
builds_add_derivation_output_details_set_id 2019-12-07T18:25:38Z Christopher Baines <mail@cbaines.net> # Add a derivation_output_details_set_id column to builds
derivations_hash_index 2019-12-24T22:54:19Z Christopher Baines <mail@cbaines.net> # Add index on derivations for the hash component of the filename

View File

@ -0,0 +1,7 @@
-- Verify guix-data-service:derivations_hash_index on pg
BEGIN;
-- XXX Add verifications here.
ROLLBACK;