Skip to content
Snippets Groups Projects
Commit 401adcd2b3a7 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis
Browse files

Merge branch 'docs/add-analyze-verbose-progress-query' into 'master'

Add ANALYZE VERBOSE progress query

See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7848



Merged-by: default avatarAchilleas Pipinellis <axil@gitlab.com>
Co-authored-by: default avatarAnton Smith <asmith@gitlab.com>
No related branches found
No related tags found
No related merge requests found
......@@ -531,6 +531,18 @@
sudo gitlab-psql -c 'SET statement_timeout = 0; ANALYZE VERBOSE;'
```
The execution time of the `ANALYZE` command can vary significantly depending on your database size. To monitor the progress of this operation,
you can periodically run the following query in another console session. The `tables_remaining` column should gradually reach `0`:
```shell
sudo gitlab-psql -c "
SELECT
COUNT(*) AS total_tables,
SUM(CASE WHEN last_analyze IS NULL OR last_analyze < (NOW() - INTERVAL '2 hours') THEN 1 ELSE 0 END) AS tables_remaining
FROM pg_stat_user_tables;
"
```
_After you have verified that your GitLab instance is running correctly_, you
can clean up the old database files:
......@@ -862,6 +874,16 @@
SET statement_timeout = 0; ANALYZE VERBOSE;
```
The execution time of the `ANALYZE` command can vary significantly depending on your database size. To monitor the progress of this operation,
you can periodically run the following query in another PostgreSQL database console. The `tables_remaining` column should gradually reach `0`:
```SQL
SELECT
COUNT(*) AS total_tables,
SUM(CASE WHEN last_analyze IS NULL OR last_analyze < (NOW() - INTERVAL '2 hours') THEN 1 ELSE 0 END) AS tables_remaining
FROM pg_stat_user_tables;
```
If the upgrade used `pg_dump` and `pg_restore`, run the following query on the PostgreSQL database console:
```SQL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment