From fb9d99a076ac3b4211f6dd96e125ee8d5d1477ef Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 12 Nov 2022 10:40:43 +0000 Subject: Add extended statistics on package_derivations This helps row count estimates when filtering on system_id and target. --- sqitch/deploy/package_derivations_extended_statistics.sql | 9 +++++++++ sqitch/revert/package_derivations_extended_statistics.sql | 7 +++++++ sqitch/sqitch.plan | 1 + sqitch/verify/package_derivations_extended_statistics.sql | 7 +++++++ 4 files changed, 24 insertions(+) create mode 100644 sqitch/deploy/package_derivations_extended_statistics.sql create mode 100644 sqitch/revert/package_derivations_extended_statistics.sql create mode 100644 sqitch/verify/package_derivations_extended_statistics.sql (limited to 'sqitch') diff --git a/sqitch/deploy/package_derivations_extended_statistics.sql b/sqitch/deploy/package_derivations_extended_statistics.sql new file mode 100644 index 0000000..f1aeaaf --- /dev/null +++ b/sqitch/deploy/package_derivations_extended_statistics.sql @@ -0,0 +1,9 @@ +-- Deploy guix-data-service:package_derivations_extended_statistics to pg + +BEGIN; + +CREATE STATISTICS package_derivations_mcv (mcv) ON system_id, target FROM package_derivations; + +CREATE STATISTICS package_derivations_ndistinct (ndistinct) ON system_id, target FROM package_derivations; + +COMMIT; diff --git a/sqitch/revert/package_derivations_extended_statistics.sql b/sqitch/revert/package_derivations_extended_statistics.sql new file mode 100644 index 0000000..65f3208 --- /dev/null +++ b/sqitch/revert/package_derivations_extended_statistics.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:package_derivations_extended_statistics from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 5af890d..8bc4aeb 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -90,3 +90,4 @@ fix_git_commits_duplicates 2022-06-17T10:39:50Z Chris # Fix git_co git_repositories_query_substitutes 2022-09-09T11:35:16Z Chris # Add git_repositories.query_substitutes package_derivations_id_package_id_idx 2022-09-14T09:24:30Z Chris # Add index on package_derivations id and package_id blocked_builds 2022-11-07T11:27:28Z Chris # Add blocked_builds +package_derivations_extended_statistics 2022-11-12T10:40:18Z Chris # Add extended statistics on package_derivations diff --git a/sqitch/verify/package_derivations_extended_statistics.sql b/sqitch/verify/package_derivations_extended_statistics.sql new file mode 100644 index 0000000..1053d91 --- /dev/null +++ b/sqitch/verify/package_derivations_extended_statistics.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:package_derivations_extended_statistics on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3