From 6e390c9b9d8784a7f37e2eb2d304d30ca2dc6c3a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 27 Dec 2020 10:37:06 +0000 Subject: Increase statistics targets for the derivation_inputs table It has a lot of rows, and this seems to help the query planning for select-required-builds-that-failed, as I think it helps PostgreSQL better estimate the row counts that different parts of the query will produce. --- sqitch/deploy/increase_derivation_inputs_statistics_targets.sql | 8 ++++++++ sqitch/revert/increase_derivation_inputs_statistics_targets.sql | 7 +++++++ sqitch/sqitch.plan | 1 + sqitch/verify/increase_derivation_inputs_statistics_targets.sql | 7 +++++++ 4 files changed, 23 insertions(+) create mode 100644 sqitch/deploy/increase_derivation_inputs_statistics_targets.sql create mode 100644 sqitch/revert/increase_derivation_inputs_statistics_targets.sql create mode 100644 sqitch/verify/increase_derivation_inputs_statistics_targets.sql (limited to 'sqitch') diff --git a/sqitch/deploy/increase_derivation_inputs_statistics_targets.sql b/sqitch/deploy/increase_derivation_inputs_statistics_targets.sql new file mode 100644 index 0000000..e0da041 --- /dev/null +++ b/sqitch/deploy/increase_derivation_inputs_statistics_targets.sql @@ -0,0 +1,8 @@ +-- Deploy guix-data-service:increase_derivation_inputs_statistics_targets to pg + +BEGIN; + +ALTER TABLE derivation_inputs ALTER COLUMN derivation_id SET STATISTICS 10000; +ALTER TABLE derivation_inputs ALTER COLUMN derivation_output_id SET STATISTICS 10000; + +COMMIT; diff --git a/sqitch/revert/increase_derivation_inputs_statistics_targets.sql b/sqitch/revert/increase_derivation_inputs_statistics_targets.sql new file mode 100644 index 0000000..c5023b0 --- /dev/null +++ b/sqitch/revert/increase_derivation_inputs_statistics_targets.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:increase_derivation_inputs_statistics_targets from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 85363da..fc3b998 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -76,3 +76,4 @@ git_repositories_add_fetch_with_authentication_field 2020-10-07T17:31:20Z Christ create_latest_build_status 2020-10-13T17:22:39Z Christopher Baines # Create the latest_build_status table regenerate_latest_build_status 2020-10-21T18:39:03Z Christopher Baines # Regenerate the latest_build_status table guix_revision_package_derivations_add_package_derivation_index 2020-10-27T16:58:08Z Christopher Baines # Add index for guix_revision_package_derivations.package_derivation_id +increase_derivation_inputs_statistics_targets 2020-12-27T10:34:58Z Christopher Baines # Increase stats targets on derivation_inputs fields diff --git a/sqitch/verify/increase_derivation_inputs_statistics_targets.sql b/sqitch/verify/increase_derivation_inputs_statistics_targets.sql new file mode 100644 index 0000000..e647e8e --- /dev/null +++ b/sqitch/verify/increase_derivation_inputs_statistics_targets.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:increase_derivation_inputs_statistics_targets on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3