Create new cronjob to execute analyzes
Create the following cron job gather statistics in an optimized manner and trying to reduce the pressure for the subtransaction. Epic and Issue related: https://gitlab.com/groups/gitlab-com/gl-infra/-/epics/593#note_699860739 / https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/14360
sudo gitlab-psql \
-c "set vacuum_cost_delay = 0" \
-c "\\timing on" \
-c "analyze (verbose, skip_locked) issues" \
-c "analyze (verbose, skip_locked) notes" 2>&1 \
| ts | tee -a /path/log
If we need to kill the session:
select pg_terminate_backend(pid), * from pg_stat_activity where state <> 'idle' and query ~ '^analyze';
MR: gitlab-cookbooks/gitlab-patroni!105 (merged)
Acceptance criteria:
-
Rollout in staging. Issue: https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/14376 -
Rollout in production. Issue: https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/14377
Edited by Jose Finotto