Y me propongo leer la decodificación del informe Alexey Lesovsky de Data Egret "Conceptos básicos de la monitorización PostgreSQL"
En este informe, Alexei Lesovsky hablará sobre los puntos clave de las estadĂsticas post-brutas, lo que significan y por quĂ© deberĂan estar presentes en el monitoreo; sobre quĂ© gráficos deben monitorearse, cĂłmo agregarlos y cĂłmo interpretarlos. El informe será Ăştil para los administradores de bases de datos, administradores de sistemas y desarrolladores interesados ​​en solucionar problemas de Postgres.

Mi nombre es Alexei Lesovsky, represento a Data Egret.
Unas pocas palabras acerca de ti. Comencé una vez como administrador del sistema.
Linux, , Linux, . . , , . . - , PostgreSQL. . - PostgreSQL . PostgreSQL DBA.
, , . , Zabbix. zabbix-extensions. . , Linux, .
PostgreSQL. , PostgreSQL-. pgCenter ( — ).

. , ? - , . , : «, , - , ». , – PostgreSQL, MySQL - . : « , - . ». . , - , PostgreSQL - . - GitHub, , , - . .

, PostgreSQL, . , , - , , - , .
, , , noSQL. PostgreSQL, , PostgreSQL. , , PostgreSQL . , , , .

, . - . .
, - . , . .

, . – , . . - , . , , , , - .
, , - , . .
– , , – . , . – . . .
PostgreSQL, , . . PostgreSQL , , Stats Collector, , .
(view). . . . psql , select , - PostgreSQL.
, , .
, . -- , .

, ? , – , , .

, , , , . .

, , , , : , . . . (workload), .

, , . , , , , , , - , .

, – . , . , . , .

. , , . , , .

- , , - - . , .

– . ? – , . . , , , . . .

, . , . – .
, , . - , , - , , drilldown-, .

. . , , . « ». , , , . - , , , . , . . , , . .

? . PostgreSQL pg_stat_statements. , , . , .
, , . . – , . , PostgreSQL . - , , . . 'select 1' , , .
, . pg_stat_database. xact_rollback. rollback, , . , . , , , .

, . . , , , , , - backend . , , - , , , .
, pg_stat_database. commit rollback .
, ? TPS QPS .
pg_stat_statements . , , , , .

, – - downtime.
– uptime. uptime PostgreSQL – . , . PostgreSQL , uptime. - , , - , OOM-killer PostgreSQL, PostgreSQL , shared . , , . . , downtime. uptime , postmaster . .
. , autovacuum PostgreSQL? PostgreSQL. , . , , . . . , , , .
? . .
pg_stat_activity, . . , . , , PostgreSQL - .
PostgreSQL , PostgreSQL . , , . , , stat idle-in-transaction. , . – , . , , , . , , . - , , 10-20-30 OLTP-, , , . 10-20-30 – , .

. , , .
, , PostgreSQL, . , .
. . , , . .
, , , . idle.
. , , , - , , , , . . . . - (Exception), . PostgreSQL. PostgreSQL . . , .
. - . , : , - , - , . , , , - . , . , . , . . .

. . . DB connection – 8 . . , , idle, . , . . , . .

, , pg_stat_activity. PostgreSQL, , , PostgreSQL, . . . , : , , , , , . , , stat. , stats-, , stat- . .
. , , . xact_start query_start. , , . now(), timestamp . , .
, . OLTP- – 1-2-3 . OLAP- , , , - .

, . , , . , .
, , «». , , «» - SSD . , - , - «» , SATA , .
. , - . , . , . , update delete. .
«» . ? PostgreSQL . . ? , PostgreSQL , . : , NULL , .
, .
, «». , - , . . , , . , - , .. 100 ( limit 100), . .
. , explain, , . . .

. , , . Prometheus? Prometheus? , PostgreSQL – postgres_exporter Prometheus. .

. unity , . . 5 . Insert data, Update data, Delete data, Fetch data Return data. unit . , PostgreSQL tuple (). , , – , , tuple – , tuple – , . . . tuples – . , , , .

? PostgreSQL . – pg_stat_user_tables. User_tables – , , . , PostgreSQL. Alltables, , . , .
insert, update delete. , , . . , tuples, , .
, , TopN-. , Top-5, Top-10. , . , 5 «» . TopN- , .
, , , , , . .

. , ? ?

. ? . . , . , host , , . Top, PostgreSQL, - . Top , .

, , , , , , PostgreSQL , . – 80-85-90 %. . , , , , , . - , .

, . . . , , , . , . , , , . .

pg_stat_statements. . , , . . , . , , - .
, . . , . , -. total_time, mean_time, blk_write_time blk_read_time.
, , , , , - .
. , . , - , . .
, .

. – , autovacuum .

. Maintenance, , - . , . , , .

, , «» shared , . , PostgreSQL .
, «» , . , , – . - , . . .
, pg_stat_bgwriter . - ( 10-15-20 , ) , , 3-4-5, . , , . , - . , . , .

autovacuum, , , , , autovacuum.
autovacuum . , , , autovacuum , , autovacuum .
. , DBA - , . - . , . PostgreSQL – . , , .
, , . , , , , , . , (3-4 ), . , . – . , , . , , .

PostgreSQL, . – .
PostgreSQL . . , . .
, pg_stat_replication. . 10 . -, . . 10- , . . 10 . 10- , . . , – . .
, , . pg_stat_replication. , pg_xlog_location_diff() . . .
10- pg_wal_lsn_diff(). , , , , «xlog», «wal». , . .
10- , . write lag, flush lag, replay lag. . . . , , , , .

. , . , , swap, . .
, . , . iops . latency . , , . latency, , - . , , . , .
, /proc, . , . .
. , , latency , .

. , - . , , , - .
, , .
:
- , , , .
- , , .
- , . .
- , , . , , , . .
- , , .
- , , .

, .
http://bit.do/stats_collector — . . , . , .
:
http://bit.do/dataegret_sql
http://bit.do/lesovsky_sql
. . select* from - . , , , , . . , . , , , , .
: , , - – ?
: -. , . , . Zabbi. TopN-. Okmeter, . PostgreSQL . pet-project, Prometheus Grafana. Prometheus Grafana.
: - AWR- … ? - ?
: , , AWR, . , . baselines PostgreSQL . , . sql.ru PostgreSQL. . , , . pgCenter , .
P.S.1 c postgres_exporter, ? . . m ?
P.S.2 pganalyze, is a proprietary SaaS offering which focuses on performance monitoring and automated tuning suggestions.