Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add postgresql query progress api #2797

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/_posts/databases/postgresql/2000-01-01-monitoring.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Monitoring and Auditing Your Scalingo for PostgreSQL® Addon
nav: Monitoring and Auditing
modified_at: 2024-03-26 12:00:00
modified_at: 2024-09-20 10:35:00
tags: databases postgresql addon
index: 7
---
Expand Down Expand Up @@ -89,6 +89,12 @@ stuck ones.
Viewing running queries is only available from the database dashboard.
{% endnote %}

### Using an sql client

Running queries will appear in [pg_stat_activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW) view, filtering on `state = 'active'.

You can monitor `CREATE INDEX` and `REBUILD INDEX` progress in [pg_stat_progress_create_index] (https://www.postgresql.org/docs/current/progress-reporting.html#CREATE-INDEX-PROGRESS-REPORTING).
Comment on lines +92 to +96
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this page include only Scalingo features (not PG ones), I suggest to move this to Troubleshooting
https://doc.scalingo.com/databases/postgresql/troubleshooting



## Exploring Query Statistics

Expand Down Expand Up @@ -137,3 +143,10 @@ to be activated manually.
{% note %}
Consulting query statistics is only available from the database dashboard.
{% endnote %}

## Maintenance operations

Scheduled VACUUMs are run automatically and can affect database performance.
While executing, they will appear in [pg_stat_activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW) view, not appear in [pg_stat_progress_vacuum](https://www.postgresql.org/docs/current/progress-reporting.html#VACUUM-PROGRESS-REPORTING) view.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the actual behaviour in 2023, but may have changed since then.


You can log them using [log_autovacuum_min_duration](https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-AUTOVACUUM-MIN-DURATION) parameter, and check the last time a table has been VACUUMed in [pg_stat_user_tables.last_autovacuum](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW) view.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember how I changed log_autovacuum_min_duration, maybe I asked the support, as we can't access pgsql.conf file.