From 6e390c9b9d8784a7f37e2eb2d304d30ca2dc6c3a Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
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 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 sqitch/deploy/increase_derivation_inputs_statistics_targets.sql

(limited to 'sqitch/deploy/increase_derivation_inputs_statistics_targets.sql')

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;
-- 
cgit v1.2.3

