Skip to content

Commit

Permalink
added help description about pg_stat_progress_create_index view
Browse files Browse the repository at this point in the history
  • Loading branch information
lesovsky committed Oct 2, 2019
1 parent 7eb887f commit ac9aedc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
29 changes: 15 additions & 14 deletions cmd/report/report.go
Expand Up @@ -222,20 +222,21 @@ func parseFilterString() {
// doDescribe shows detailed description of the requested stats
func doDescribe() {
var m = map[string]string{
stat.DatabaseView: stat.PgStatDatabaseDescription,
stat.ActivityView: stat.PgStatActivityDescription,
stat.ReplicationView: stat.PgStatReplicationDescription,
stat.TablesView: stat.PgStatTablesDescription,
stat.IndexesView: stat.PgStatIndexesDescription,
stat.FunctionsView: stat.PgStatFunctionsDescription,
stat.SizesView: stat.PgStatSizesDescription,
stat.ProgressVacuumView: stat.PgStatProgressVacuumDescription,
stat.ProgressClusterView: stat.PgStatProgressClusterDescription,
stat.StatementsTimingView: stat.PgStatStatementsTimingDescription,
stat.StatementsGeneralView: stat.PgStatStatementsGeneralDescription,
stat.StatementsIOView: stat.PgStatStatementsIODescription,
stat.StatementsTempView: stat.PgStatStatementsTempDescription,
stat.StatementsLocalView: stat.PgStatStatementsLocalDescription,
stat.DatabaseView: stat.PgStatDatabaseDescription,
stat.ActivityView: stat.PgStatActivityDescription,
stat.ReplicationView: stat.PgStatReplicationDescription,
stat.TablesView: stat.PgStatTablesDescription,
stat.IndexesView: stat.PgStatIndexesDescription,
stat.FunctionsView: stat.PgStatFunctionsDescription,
stat.SizesView: stat.PgStatSizesDescription,
stat.ProgressVacuumView: stat.PgStatProgressVacuumDescription,
stat.ProgressClusterView: stat.PgStatProgressClusterDescription,
stat.ProgressCreateIndexView: stat.PgStatProgressCreateIndexDescription,
stat.StatementsTimingView: stat.PgStatStatementsTimingDescription,
stat.StatementsGeneralView: stat.PgStatStatementsGeneralDescription,
stat.StatementsIOView: stat.PgStatStatementsIODescription,
stat.StatementsTempView: stat.PgStatStatementsTempDescription,
stat.StatementsLocalView: stat.PgStatStatementsLocalDescription,
}

if description, ok := m[opts.ReportType]; ok {
Expand Down
23 changes: 23 additions & 0 deletions lib/stat/help.go
Expand Up @@ -206,6 +206,29 @@ Details: https://www.postgresql.org/docs/current/progress-reporting.html#VACUUM-
* - extended value, based on origin and calculated using additional functions.
Details: https://www.postgresql.org/docs/current/progress-reporting.html#VACUUM-PROGRESS-REPORTING`

// PgStatProgressCreateIndexDescription is the detailed description of pg_stat_progress_cluster view
PgStatProgressCreateIndexDescription = `Statistics about progress of create index/reindex operations based on pg_stat_progress_create_index view:
column origin description
- pid pid Process ID of this worker
- xact_age* xact_start Current transaction's duration if active
- datname datname Name of the database this worker is connected to
- relation relid Name of the relation which is processed by this worker
- index cluster_index_relid Name of the relation which is processed by this worker
- state state Current overall state of this worker
- waiting* wait_event_type,wait_event Wait event name and type for which the worker is waiting, if any
- phase phase Current processing phase of operation
- locker_pid current_locker_pid Process ID of the locker currently being waited for
- lockers* lockers_total,lockers_done Total number of lockers to wait for, and number of lockers already waited for.
- blks_total/done_%* blocks_total,blocks_done Total number of blocks to be processed and percent of already processed in the current phase, in kB
- tup_total/done_%* tuples_total,tuples_done Total number of tuples to be processed and percent of already processed in the current phase
- parts_total/done_%* partitions_total,partitions_done Total number of partitions on which the index is to be created, and the number of partitions on which the index has been completed
- query query Text of this workers's "query"
* - extended value, based on origin and calculated using additional functions.
Details: https://www.postgresql.org/docs/current/progress-reporting.html#VACUUM-PROGRESS-REPORTING`

// PgStatStatementsTimingDescription is the detailed description of pg_stat_statements section about timing stats
Expand Down
4 changes: 2 additions & 2 deletions lib/stat/queries.go
Expand Up @@ -329,8 +329,8 @@ p.datname,
p.relid::regclass AS relation,
p.cluster_index_relid::regclass AS index,
a.state,
p.phase,
coalesce((a.wait_event_type ||'.'|| a.wait_event), 'f') AS waiting,
p.phase,
p.heap_blks_total * (SELECT current_setting('block_size')::int / 1024) AS t_size,
round(100 * p.heap_blks_scanned / greatest(p.heap_blks_total,1), 2) AS "scanned_%",
coalesce(p.heap_tuples_scanned, 0) AS tup_scanned,
Expand All @@ -350,8 +350,8 @@ p.datname,
p.relid::regclass AS relation,
p.index_relid::regclass AS index,
a.state,
p.phase,
coalesce((a.wait_event_type ||'.'|| a.wait_event), 'f') AS waiting,
p.phase,
current_locker_pid AS locker_pid,
lockers_total ||'/'|| lockers_done AS lockers,
p.blocks_total * (SELECT current_setting('block_size')::int / 1024) ||'/'|| round(100 * p.blocks_done / greatest(p.blocks_total, 1), 2) AS "blks_total/done_%",
Expand Down

0 comments on commit ac9aedc

Please sign in to comment.