-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from qonto/group-alerts-for-long-running-queri…
…es-to-avoid-alert-spam feat: raise alert on long running queries per user instead of single pid
- Loading branch information
Showing
7 changed files
with
57 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
content/runbooks/postgresql/PostgreSQLLongRunningQueries.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Long running queries | ||
--- | ||
|
||
# PostgreSQLLongRunningQueries | ||
|
||
## Meaning | ||
|
||
Alert is triggered when SQL queries run for an extended period. | ||
|
||
## Impact | ||
|
||
- Block WAL file rotation | ||
|
||
- Could block vacuum operations | ||
|
||
- Could block other queries due to locks | ||
|
||
- Could lead to replication lag on replica | ||
|
||
## Diagnosis | ||
|
||
1. Open `PostgreSQL server live` dashboard | ||
|
||
1. Click on the queries to get details | ||
|
||
## Mitigation | ||
|
||
1. Identify the PIDs of the long running queries | ||
|
||
{{< details title="SQL" open=false >}} | ||
{{% sql "../postgresql/sql/list-long-running-transactions.sql" %}} | ||
{{< /details >}} | ||
|
||
1. Cancel the queries | ||
|
||
{{% sql "sql/cancel_backend.sql" %}} | ||
|
||
1. If queries do not get cancelled, kill them | ||
|
||
{{% sql "sql/terminate_backend.sql" %}} | ||
|
||
## Additional resources | ||
|
||
n/a |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters