Documentation ¶
Index ¶
Constants ¶
View Source
const G002_TX_AGE_MORE_1H string = "G002_TX_AGE_MORE_1H"
View Source
const MSG_NODE string = "node: %s"
View Source
const MSG_NODES string = "nodes: %s"
View Source
const MSG_TX_AGE_MORE_1H_CONCLUSION string = "[P1] There are transactions with transaction age > 1 hour, observed on: %s. " +
"For OLTP databases, it is important to avoid long running transactions. At the moment of this report generation, " +
"such transactions were detected. Long-lasting transactions lead to two big issues in the database, both affecting the system " +
"performance negatively: \n" +
" - higher risks of having locking issues (unless such transactions are read-only and do not involve explicit locking),\n" +
" - VACUUM cannot process some entries in tables and indexes, hence bloat grows more and faster than usual."
View Source
const MSG_TX_AGE_MORE_1H_RECOMMENDATION string = "[P1] There are transactions with transaction age > 1 hour. For better understanding, " +
"refer to monitoring (add transaction-related graphs there if they are missing; it is important to split data by `state` " +
"in `pg_stat_activity`). Consider the following tactics to avoid long running transactions:\n" +
" - split transactions to smaller ones – ideally, OLTP workload should not have transactions lasting more than a few seconds;\n" +
" - if long-lasting transactions often appear in `pg_stat_activity` with `'idle in transaction'` state, this is a sign that delays happen on " +
"application side; it is very important to reduce such delays as much as possible;\n" +
" - if long-lasting transactions are read-only (for example, dumping tables using pg_dump, exporting data using " +
"regular `SELECT` or `COPY`, or building some analytical reports), consider offloading this work to a replica; it is important " +
"that such replica works with `host_standby_feedback = off` and is allowed to lag significantly in applying WALs.\n"
Variables ¶
This section is empty.
Functions ¶
func G002PreprocessReportData ¶
func G002PreprocessReportData(data map[string]interface{})
func G002Process ¶
func G002Process(report G002Report) (checkup.ReportResult, error)
Types ¶
type G002Connection ¶
type G002Connection struct { Num int `json:"num"` User string `json:"user"` Database string `json:"database"` CurrentState string `json:"current_state"` Count int `json:"count"` StateMore1m int `json:"state_changed_more_1m_ago"` StateMore1h int `json:"state_changed_more_1h_ago"` TxMore1m int `json:"tx_age_more_1m"` TxMore1h int `json:"tx_age_more_1h"` }
type G002Report ¶
type G002Report struct { Project string `json:"project"` Name string `json:"name"` CheckId string `json:"checkId"` Timestamptz string `json:"timestamptz"` Database string `json:"database"` Dependencies map[string]interface{} `json:"dependencies"` LastNodesJson checkup.ReportLastNodes `json:"last_nodes_json"` Results G002ReportHostsResults `json:"results"` }
type G002ReportHostResult ¶
type G002ReportHostResult struct { Data map[string]G002Connection `json:"data"` NodesJson checkup.ReportLastNodes `json:"nodes.json"` }
type G002ReportHostsResults ¶
type G002ReportHostsResults map[string]G002ReportHostResult
Click to show internal directories.
Click to hide internal directories.