PostgreSQL的监控一(pgsnap & pgstatspack)

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
简介: 监控postgreSQL的方法很多,本文做个简单的比较。 大的方面,监控方法可以分为以下几种 1 直接利用PG提供的性能统计数据 PG的很多性能数据可以通过查询pg_stat_或pg_statio_开头的系统表获取。
监控postgreSQL的方法很多,本文做个简单的比较。
大的方面,监控方法可以分为以下几种

1 直接利用PG提供的性能统计数据

PG的很多性能数据可以通过查询pg_stat_或pg_statio_开头的系统表获取。
比如:

  1. postgres=# \x
  2. Expanded display is on.
  3. postgres=# select * from pg_stat_database where datname='postgres';
  4. -[ RECORD 1 ]--+------------------------------
  5. datid | 12896
  6. datname | postgres
  7. numbackends | 1
  8. xact_commit | 5692
  9. xact_rollback | 3
  10. blks_read | 155
  11. blks_hit | 157853
  12. tup_returned | 2566687
  13. tup_fetched | 32370
  14. tup_inserted | 0
  15. tup_updated | 7
  16. tup_deleted | 0
  17. conflicts | 0
  18. temp_files | 0
  19. temp_bytes | 0
  20. deadlocks | 0
  21. blk_read_time | 0
  22. blk_write_time | 0
  23. stats_reset | 2014-09-23 01:23:12.123612+08
http://www.postgresql.org/docs/current/static/monitoring-stats.html

2  PG专用的监控工具

pgsnap, pgstatspack,pgwatch,pg_statsinfo等。这些工具主要做PG的性能分析,状态查看的。不能做故障通知。

2.1 pgsnap

http://pgsnap.projects.pgfoundry.org/

pgsnap是个PostgreSQL报告工具,不需要在数据库上安装任何东西,可以远程连接到数据库,然后通过PG已有的系统表查询统计数据并生成HTML报告。
使用例:

  1. [root@zabbix ~]# tar xfz pgsnap-0.8.0.tar.gz
  2. [root@zabbix ~]# cd pgsnap-0.8.0
  3. [root@zabbix pgsnap-0.8.0]# ./pgsnap.php -h localhost -p 5432 -U postgres postgres
  4. Connecting to postgres database...
  5. Adding some HTML files...
  6. Getting Misc informations...
  7. Getting General informations...
  8. sh: pg_config: command not found
  9. sh: pg_controldata: command not found
  10. Getting Global Informations...
  11.   pg_buffercache
  12. Getting Database Informations...
  13.   pg_buffercache
  14.   pgstattuple
  15.   pgstattuple on indexes
  16. Getting Current Activities Informations...
  17. Getting Statistical Informations...
  18. Getting Tools Informations...
  19.   pgPool

生成的结果,可参考下面的demo
http://pgsnap.projects.pgfoundry.org/pgbench_snap_20120930/

2.2 pgstatspack

http://pgfoundry.org/projects/pgstatspack/
前面介绍的pgsnap真的只是个某一时间点的snap采集工具,不能对一段时间内的变化做分析。
pgstatspack稍微进了一步,它把每次采集的snap信息存在数据库里,然后可以对2个snap信息进行比较生成文本的性能报告。
下面是使用的例子:

1)安装pgstatspack

  1. [root@zabbix ~]# tar xfz /root/pgstatspack_version_2.3.1.tar.gz
  2. [root@zabbix ~]# cd pgstatspack
  3. [root@zabbix pgstatspack]# su postgres ./install_pgstats.sh
  4. Results for database template1
  5. Installing Statistics Package for database template1
  6. Results for database zabbix
  7. Installing Statistics Package for database zabbix

2)创建snapshot

  1. [root@zabbix pgstatspack]# su postgres ./bin/snapshot.sh
  2. Results for database zabbix
  3.  pgstatspack_snap
  4. ------------------
  5.                 1
  6. (1 row)

  7. [root@zabbix pgstatspack]# su postgres ./bin/snapshot.sh
  8. Results for database zabbix
  9.  pgstatspack_snap
  10. ------------------
  11.                 2
  12. (1 row)

3)生成报告


  1. [root@zabbix pgstatspack]# su postgres ./bin/pgstatspack_report.sh
    /root/pgstatspack/bin /root/pgstatspack
    Please specify a username:
    postgres
    List of available databases:

    1 .  zabbix

    Please select a number from the above list [ 1 -  1 ]
    1
    snapid |             ts             |     description    
    --------+----------------------------+---------------------
         2 | 2014-09-25 01:13:02.292668 | cron based snapshot
         1 | 2014-09-25 01:09:20.71257  | cron based snapshot
    (2 rows)

    Enter start snapshot id : 1
    Enter stop snapshot id  : 2
    Using file name: /tmp/pgstatreport_zabbix_1_2.txt
    ###########################################################################################################
    PGStatspack version 2.3 by uwe.bartels@gmail.com
    ###########################################################################################################

    Snapshot information
    Begin snapshot :
    snapid |            ts             |     description    
    --------+---------------------------+---------------------
         1 | 2014-09-25 01:09:20.71257 | cron based snapshot
    (1 row)

    End snapshot   :
    snapid |             ts             |     description    
    --------+----------------------------+---------------------
         2 | 2014-09-25 01:13:02.292668 | cron based snapshot
    (1 row)

    Seconds in snapshot:  221.580098


    Database version
                                                      version                                                    
    --------------------------------------------------------------------------------------------------------------
    PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
    (1 row)

    Database information
    current_database | dbsize
    ------------------+--------
    zabbix           | 140 MB
    (1 row)


    Database statistics
    database  | tps  | hitrate | lio_ps | pio_ps | rollbk_ps
    -----------+------+---------+--------+--------+-----------
    zabbix    | 1.73 |   99.00 | 164.87 |   0.58 |      0.00
    postgres  | 0.05 |   99.00 |   1.73 |   0.00 |      0.00
    template1 | 0.04 |   99.00 |   0.99 |   0.00 |      0.00
    template0 | 0.00 |    0.00 |   0.00 |   0.00 |      0.00
    (4 rows)


    Top 20 tables ordered by table size changes
               table             | table_growth | index_growth
    ------------------------------+--------------+--------------
    pg_toast.pg_toast_16818      |              |            0
    pg_catalog.pg_ts_config      |              |            0
    pg_toast.pg_toast_17807      |              |            0
    pg_toast.pg_toast_16792      |              |            0
    public.services_times        |              |            0
    pg_catalog.pg_authid         |              |            0
    public.opcommand_hst         |              |            0
    public.icon_mapping          |              |            0
    pg_catalog.pg_cast           |              |            0
    pg_toast.pg_toast_12481      |              |            0
    pg_catalog.pg_foreign_server |              |            0
    pg_catalog.pg_event_trigger  |              |            0
    pg_catalog.pg_namespace      |              |            0
    public.nodes                 |              |            0
    pg_toast.pg_toast_12491      |              |            0
    public.pgstatspack_indexes   |              |        32768
    public.history_sync          |              |            0
    pg_catalog.pg_depend         |              |            0
    public.profiles              |              |            0
    pg_toast.pg_toast_2396       |              |            0
    (20 rows)


    Top 20 tables ordered by high table to index read ratio
              table            | system_read_pct | table_read_pct | index_read_pct
    ----------------------------+-----------------+----------------+----------------
    pg_catalog.pg_class        |              23 |             88 |             11
    public.pgstatspack_names   |              21 |             98 |              1
    public.items               |              17 |             98 |              1
    public.hosts               |               6 |             99 |              0
    pg_catalog.pg_proc         |               5 |             93 |              6
    pg_catalog.pg_index        |               4 |             83 |             16
    public.pgstatspack_tables  |               3 |            100 |              0
    public.triggers            |               3 |             99 |              0
    public.functions           |               3 |             98 |              1
    pg_catalog.pg_attribute    |               3 |              0 |            100
    pg_catalog.pg_opclass      |               1 |              0 |            100
    public.globalmacro         |               0 |            100 |              0
    public.interface           |               0 |            100 |              0
    public.config              |               0 |            100 |              0
    public.pgstatspack_indexes |               0 |            100 |              0
    pg_catalog.pg_am           |               0 |            100 |              0
    public.expressions         |               0 |            100 |              0
    public.host_inventory      |               0 |            100 |              0
    public.regexps             |               0 |            100 |              0
    public.media_type          |               0 |            100 |              0
    (20 rows)


    Top 20 tables ordered by inserts
                table             | table_inserts
    -------------------------------+---------------
    public.history_uint           |           797
    public.pgstatspack_names      |           728
    public.pgstatspack_indexes    |           425
    public.pgstatspack_tables     |           228
    public.history                |           196
    public.pgstatspack_settings   |            34
    pg_catalog.pg_statistic       |            29
    public.pgstatspack_sequences  |             8
    public.pgstatspack_database   |             4
    public.history_str            |             4
    public.pgstatspack_snap       |             1
    public.pgstatspack_bgwriter   |             1
    public.nodes                  |             0
    pg_catalog.pg_namespace       |             0
    pg_catalog.pg_db_role_setting |             0
    pg_catalog.pg_foreign_server  |             0
    public.dchecks                |             0
    pg_catalog.pg_event_trigger   |             0
    pg_toast.pg_toast_12481       |             0
    pg_catalog.pg_cast            |             0
    (20 rows)


    Top 20 tables ordered by updates
                table             | table_updates
    -------------------------------+---------------
    public.hosts                  |            12
    pg_catalog.pg_event_trigger   |             0
    pg_catalog.pg_description     |             0
    pg_toast.pg_toast_16792       |             0
    public.dchecks                |             0
    public.pgstatspack_names      |             0
    pg_toast.pg_toast_12491       |             0
    public.icon_mapping           |             0
    pg_catalog.pg_cast            |             0
    pg_toast.pg_toast_12481       |             0
    pg_catalog.pg_foreign_server  |             0
    pg_catalog.pg_db_role_setting |             0
    pg_catalog.pg_namespace       |             0
    public.nodes                  |             0
    public.config                 |             0
    public.pgstatspack_indexes    |             0
    public.history_sync           |             0
    pg_catalog.pg_depend          |             0
    public.opcommand_hst          |             0
    public.profiles               |             0
    (20 rows)


    Top 20 tables ordered by deletes
                table             | table_deletes
    -------------------------------+---------------
    public.opcommand_hst          |             0
    pg_catalog.pg_event_trigger   |             0
    public.config                 |             0
    pg_toast.pg_toast_16792       |             0
    public.dchecks                |             0
    public.pgstatspack_names      |             0
    pg_toast.pg_toast_12491       |             0
    public.icon_mapping           |             0
    pg_catalog.pg_cast            |             0
    pg_toast.pg_toast_12481       |             0
    pg_catalog.pg_foreign_server  |             0
    pg_catalog.pg_db_role_setting |             0
    pg_catalog.pg_namespace       |             0
    public.nodes                  |             0
    pg_catalog.pg_description     |             0
    public.pgstatspack_indexes    |             0
    public.history_sync           |             0
    pg_catalog.pg_depend          |             0
    public.profiles               |             0
    pg_toast.pg_toast_17807       |             0
    (20 rows)


    Tables ordered by percentage of tuples scanned
               table             | rows_read_pct | tab_hitrate | idx_hitrate | tab_read | tab_hit | idx_read | idx_hit
    ------------------------------+---------------+-------------+-------------+----------+---------+----------+---------
    pg_catalog.pg_class          |            23 |          99 |          99 |        1 |    3101 |        0 |    5212
    public.pgstatspack_names     |            21 |          99 |          99 |        8 |    1235 |       11 |    2994
    public.items                 |            17 |          99 |          99 |        0 |     908 |        0 |     118
    public.hosts                 |             6 |          99 |          97 |        0 |     312 |        0 |      40
    pg_catalog.pg_proc           |             5 |          93 |          99 |       27 |     383 |        4 |     572
    pg_catalog.pg_index          |             4 |          99 |          99 |        0 |     682 |        0 |    1258
    public.functions             |             3 |          98 |          98 |        0 |      80 |        0 |      96
    public.triggers              |             3 |          98 |          94 |        0 |      96 |        0 |      16
    public.pgstatspack_tables    |             3 |          97 |          98 |        7 |     308 |        2 |     235
    pg_catalog.pg_attribute      |             3 |          99 |          99 |       11 |    1503 |        1 |    2901
    pg_catalog.pg_opclass        |             1 |          99 |          99 |        0 |     631 |        0 |     230
    pg_toast.pg_toast_2619       |             0 |          50 |          66 |        0 |       1 |        0 |       2
    public.regexps               |             0 |          80 |           0 |        0 |       4 |        0 |       0
    public.host_inventory        |             0 |          80 |           0 |        0 |       4 |        0 |       0
    pg_catalog.pg_type           |             0 |          99 |          99 |        0 |     310 |        0 |     674
    pg_catalog.pg_amop           |             0 |          99 |          99 |        0 |     479 |        0 |     740
    pg_catalog.pg_attrdef        |             0 |          99 |          99 |        0 |     198 |        0 |     258
    pg_toast.pg_toast_1255       |             0 |          66 |          75 |        0 |       2 |        0 |       3
    pg_catalog.pg_aggregate      |             0 |          83 |          90 |        0 |       5 |        0 |       9
    public.pgstatspack_bgwriter  |             0 |          66 |          66 |        1 |       4 |        2 |       6
    public.trigger_depends       |             0 |          80 |          80 |        0 |       4 |        0 |       4
    pg_toast.pg_toast_2618       |             0 |          68 |          96 |        5 |      13 |        0 |      24
    pg_catalog.pg_tablespace     |             0 |          90 |          95 |        0 |      10 |        0 |      20
    public.media_type            |             0 |          80 |          80 |        0 |       4 |        0 |       4
    pg_catalog.pg_trigger        |             0 |          99 |          99 |        0 |     179 |        0 |     218
    pg_catalog.pg_am             |             0 |          96 |           0 |        0 |      31 |        0 |       0
    public.expressions           |             0 |          80 |           0 |        0 |       4 |        0 |       0
    public.drules                |             0 |          88 |          88 |        0 |       8 |        0 |       8
    public.interface             |             0 |          80 |           0 |        0 |       4 |        0 |       0
    pg_catalog.pg_language       |             0 |          50 |          66 |        0 |       1 |        0 |       2
    public.pgstatspack_sequences |             0 |          88 |          85 |        1 |      16 |        2 |      18
    public.pgstatspack_database  |             0 |          71 |          70 |        1 |       5 |        2 |       7
    public.httptest              |             0 |          98 |          98 |        0 |      90 |        0 |      90
    public.pgstatspack_settings  |             0 |          97 |          95 |        1 |      68 |        2 |      70
    public.config                |             0 |          80 |          92 |        0 |       4 |        0 |      12
    pg_catalog.pg_database       |             0 |          98 |          99 |        0 |      83 |        0 |     108
    pg_catalog.pg_cast           |             0 |          99 |          99 |        0 |     159 |        0 |     615
    pg_catalog.pg_namespace      |             0 |          97 |          98 |        0 |      44 |        0 |      93
    public.pgstatspack_indexes   |             0 |          98 |          98 |        7 |     445 |        5 |     564
    pg_catalog.pg_rewrite        |             0 |          76 |          97 |        5 |      20 |        0 |      40
    pg_catalog.pg_authid         |             0 |          95 |          97 |        0 |      19 |        0 |      38
    public.hosts_templates       |             0 |          80 |          80 |        0 |       4 |        0 |       4
    pg_catalog.pg_statistic      |             0 |          99 |          99 |        0 |     141 |        0 |    1104
    pg_catalog.pg_operator       |             0 |          99 |          99 |        1 |     482 |        0 |     651
    pg_catalog.pg_amproc         |             0 |          99 |          99 |        0 |     168 |        0 |     375
    public.globalmacro           |             0 |          80 |           0 |        0 |       4 |        0 |       0
    (46 rows)


    Indexes ordered by scans
                          index                        |             table             | scans | tup_read | tup_fetch | idx_blks_read | idx_blks_hit
    ----------------------------------------------------+-------------------------------+-------+----------+-----------+---------------+--------------
    pg_catalog.pg_class_oid_index                      | pg_catalog.pg_class           |  2456 |     2456 |      2456 |             0 |         4951
    pg_catalog.pg_attribute_relid_attnum_index         | pg_catalog.pg_attribute       |  1433 |     3737 |      3737 |             1 |         2901
    pg_catalog.pg_cast_source_target_index             | pg_catalog.pg_cast            |   598 |      159 |       159 |             0 |          615
    pg_catalog.pg_index_indexrelid_index               | pg_catalog.pg_index           |   534 |      534 |       534 |             0 |         1100
    pg_catalog.pg_statistic_relid_att_inh_index        | pg_catalog.pg_statistic       |   510 |       86 |        86 |             0 |         1104
    pg_catalog.pg_type_oid_index                       | pg_catalog.pg_type            |   297 |      296 |       296 |             0 |          622
    pg_catalog.pg_proc_oid_index                       | pg_catalog.pg_proc            |   247 |      247 |       247 |             0 |          527
    pg_catalog.pg_amop_fam_strat_index                 | pg_catalog.pg_amop            |   214 |      214 |       214 |             0 |          452
    pg_catalog.pg_operator_oid_index                   | pg_catalog.pg_operator        |   179 |      179 |       179 |             0 |          383
    pg_catalog.pg_amproc_fam_proc_index                | pg_catalog.pg_amproc          |   172 |      258 |       258 |             0 |          375
    public.idx_pgstatspack_names_name                  | public.pgstatspack_names      |   171 |      159 |       159 |             7 |         1591
    public.pgstatspack_names_pkey                      | public.pgstatspack_names      |   168 |      168 |       168 |             4 |         1403
    pg_catalog.pg_opclass_oid_index                    | pg_catalog.pg_opclass         |   145 |      145 |       145 |             0 |          176
    pg_catalog.pg_amop_opr_fam_index                   | pg_catalog.pg_amop            |   131 |      265 |       265 |             0 |          288
    pg_catalog.pg_operator_oprname_l_r_n_index         | pg_catalog.pg_operator        |   122 |      406 |       406 |             0 |          268
    pg_catalog.pg_attrdef_adrelid_adnum_index          | pg_catalog.pg_attrdef         |   119 |      949 |       949 |             0 |          258
    pg_catalog.pg_class_relname_nsp_index              | pg_catalog.pg_class           |   118 |       68 |        68 |             0 |          261
    pg_catalog.pg_trigger_tgrelid_tgname_index         | pg_catalog.pg_trigger         |   104 |      612 |       612 |             0 |          218
    public.httptest_3                                  | public.httptest               |    90 |       90 |        90 |             0 |           90
    pg_catalog.pg_db_role_setting_databaseid_rol_index | pg_catalog.pg_db_role_setting |    80 |        0 |         0 |             0 |           80
    public.escalations_1                               | public.escalations            |    74 |        0 |         0 |             0 |           74
    pg_catalog.pg_index_indrelid_index                 | pg_catalog.pg_index           |    68 |      119 |       119 |             0 |          158
    pg_catalog.pg_namespace_nspname_index              | pg_catalog.pg_namespace       |    62 |       35 |        35 |             0 |           89
    public.items_1                                     | public.items                  |    42 |      216 |        40 |             0 |           86
    pg_catalog.pg_opclass_am_name_nsp_index            | pg_catalog.pg_opclass         |    40 |     1568 |      1568 |             0 |           54
    public.hosts_pkey                                  | public.hosts                  |    40 |       40 |        40 |             0 |           40
    pg_catalog.pg_database_oid_index                   | pg_catalog.pg_database        |    39 |       39 |        39 |             0 |           59
    public.pgstatspack_settings_pk                     | public.pgstatspack_settings   |    35 |       68 |        34 |             2 |           70
    public.functions_2                                 | public.functions              |    32 |       32 |        32 |             0 |           64
    pg_catalog.pg_database_datname_index               | pg_catalog.pg_database        |    29 |       29 |        29 |             0 |           49
    pg_catalog.pg_rewrite_rel_rulename_index           | pg_catalog.pg_rewrite         |    25 |       27 |        27 |             0 |           40
    pg_catalog.pg_type_typname_nsp_index               | pg_catalog.pg_type            |    21 |       14 |        14 |             0 |           52
    pg_catalog.pg_proc_proname_args_nsp_index          | pg_catalog.pg_proc            |    19 |       79 |        79 |             4 |           45
    public.items_pkey                                  | public.items                  |    16 |       16 |        16 |             0 |           32
    public.functions_1                                 | public.functions              |    16 |       16 |        16 |             0 |           32
    pg_toast.pg_toast_2618_index                       | pg_toast.pg_toast_2618        |    15 |       28 |        28 |             0 |           24
    public.media_2                                     | public.media                  |    12 |        0 |         0 |             0 |           16
    pg_catalog.pg_tablespace_oid_index                 | pg_catalog.pg_tablespace      |    10 |       10 |        10 |             0 |           19
    pg_catalog.pg_authid_oid_index                     | pg_catalog.pg_authid          |    10 |       10 |        10 |             0 |           20
    pg_catalog.pg_authid_rolname_index                 | pg_catalog.pg_authid          |     9 |        9 |         9 |             0 |           18
    public.pgstatspack_sequences_pk                    | public.pgstatspack_sequences  |     9 |       16 |         8 |             2 |           18
    public.drules_1                                    | public.drules                 |     8 |        8 |         8 |             0 |            8
    public.triggers_pkey                               | public.triggers               |     8 |        8 |         8 |             0 |           16
    public.alerts_4                                    | public.alerts                 |     8 |        0 |         0 |             0 |           16
    pg_catalog.pg_aggregate_fnoid_index                | pg_catalog.pg_aggregate       |     5 |        5 |         5 |             0 |            9
    public.trigger_depends_1                           | public.trigger_depends        |     4 |      164 |       164 |             0 |            4
    public.hosts_templates_1                           | public.hosts_templates        |     4 |      108 |       108 |             0 |            4
    public.pgstatspack_bgwriter_pk                     | public.pgstatspack_bgwriter   |     4 |        4 |         4 |             2 |            6
    public.pgstatspack_database_pk                     | public.pgstatspack_database   |     2 |        8 |         0 |             2 |            7
    pg_toast.pg_toast_1255_index                       | pg_toast.pg_toast_1255        |     2 |        4 |         4 |             0 |            3
    public.pgstatspack_functions_pk                    | public.pgstatspack_functions  |     1 |        0 |         0 |             1 |            2
    pg_catalog.pg_language_oid_index                   | pg_catalog.pg_language        |     1 |        1 |         1 |             0 |            2
    pg_toast.pg_toast_2619_index                       | pg_toast.pg_toast_2619        |     1 |        1 |         1 |             0 |            2
    pg_catalog.pg_namespace_oid_index                  | pg_catalog.pg_namespace       |     1 |        1 |         1 |             0 |            4
    public.pgstatspack_statements_pk                   | public.pgstatspack_statements |     1 |        0 |         0 |             1 |            4
    public.hostmacro_pkey                              | public.hostmacro              |     0 |        0 |         0 |             0 |            4
    public.history_uint_1                              | public.history_uint           |     0 |        0 |         0 |            11 |         2424
    public.users_groups_pkey                           | public.users_groups           |     0 |        0 |         0 |             0 |            4
    public.maintenances_windows_pkey                   | public.maintenances_windows   |     0 |        0 |         0 |             0 |            4
    public.alerts_1                                    | public.alerts                 |     0 |        0 |         0 |             0 |            8
    public.pgstatspack_indexes_pk                      | public.pgstatspack_indexes    |     0 |        0 |         0 |             5 |          564
    public.alerts_6                                    | public.alerts                 |     0 |        0 |         0 |             0 |            8
    public.hostmacro_1                                 | public.hostmacro              |     0 |        0 |         0 |             0 |            4
    public.maintenances_windows_2                      | public.maintenances_windows   |     0 |        0 |         0 |             0 |            4
    public.media_type_pkey                             | public.media_type             |     0 |        0 |         0 |             0 |            4
    public.alerts_5                                    | public.alerts                 |     0 |        0 |         0 |             0 |            8
    pg_catalog.pg_tablespace_spcname_index             | pg_catalog.pg_tablespace      |     0 |        0 |         0 |             0 |            1
    public.history_str_1                               | public.history_str            |     0 |        0 |         0 |             0 |            8
    public.alerts_2                                    | public.alerts                 |     0 |        0 |         0 |             0 |            8
    public.config_1                                    | public.config                 |     0 |        0 |         0 |             0 |            4
    public.maintenances_1                              | public.maintenances           |     0 |        0 |         0 |             0 |            4
    public.media_pkey                                  | public.media                  |     0 |        0 |         0 |             0 |            4
    public.alerts_pkey                                 | public.alerts                 |     0 |        0 |         0 |             0 |            8
    public.users_groups_1                              | public.users_groups           |     0 |        0 |         0 |             0 |            4
    public.config_2                                    | public.config                 |     0 |        0 |         0 |             0 |            4
    public.maintenances_windows_1                      | public.maintenances_windows   |     0 |        0 |         0 |             0 |            4
    public.maintenances_pkey                           | public.maintenances           |     0 |        0 |         0 |             0 |            4
    public.timeperiods_pkey                            | public.timeperiods            |     0 |        0 |         0 |             0 |            4
    public.history_1                                   | public.history                |     0 |        0 |         0 |             2 |          600
    public.pgstatspack_tables_pk                       | public.pgstatspack_tables     |     0 |        0 |         0 |             2 |          235
    public.config_pkey                                 | public.config                 |     0 |        0 |         0 |             0 |            4
    public.media_1                                     | public.media                  |     0 |        0 |         0 |             0 |            4
    public.alerts_3                                    | public.alerts                 |     0 |        0 |         0 |             0 |            8
    public.users_groups_2                              | public.users_groups           |     0 |        0 |         0 |             0 |            4
    (84 rows)


    Sequences ordered by blks_read
            sequence         | blks_read | blks_hit
    --------------------------+-----------+----------
    public.pgstatspackid     |         0 |        1
    public.pgstatspacknameid |         0 |      728
    (2 rows)


    Top 20 SQL statements ordered by total_time
    calls | total_time | total_time_percent | rows | user | query
    -------+------------+--------------------+------+------+-------
    (0 rows)


    Top 20 user functions ordered by total_time
    funcid | function_name | calls | total_time | self_time
    --------+---------------+-------+------------+-----------
    (0 rows)


    background writer stats
    checkpoints_timed | checkpoints_req | buffers_checkpoint | buffers_clean | maxwritten_clean | buffers_backend | buffers_alloc
    -------------------+-----------------+--------------------+---------------+------------------+-----------------+---------------
                    0 |               0 |                  0 |             0 |                0 |               0 |           128
    (1 row)


    background writer relative stats
    checkpoints_timed | minutes_between_checkpoint | buffers_checkpoint | buffers_clean | buffers_backend | total_writes | avg_checkpoint_write
    -------------------+----------------------------+--------------------+---------------+-----------------+--------------+----------------------
                      |                            |                    |               |                 | 0.000 MB/s   |
    (1 row)


    Parameters
               name            |              start_setting              |              stop_setting               |        source        
    ----------------------------+-----------------------------------------+-----------------------------------------+----------------------
    max_stack_depth            | 2048                                    | 2048                                    | environment variable
    hba_file                   | /var/lib/pgsql/9.3/data/pg_hba.conf     | /var/lib/pgsql/9.3/data/pg_hba.conf     | override
    lc_time                    | en_US.UTF-8                             | en_US.UTF-8                             | configuration file
    log_destination            | stderr                                  | stderr                                  | configuration file
    ident_file                 | /var/lib/pgsql/9.3/data/pg_ident.conf   | /var/lib/pgsql/9.3/data/pg_ident.conf   | override
    log_rotation_age           | 1440                                    | 1440                                    | configuration file
    max_connections            | 100                                     | 100                                     | configuration file
    log_truncate_on_rotation   | on                                      | on                                      | configuration file
    TimeZone                   | PRC                                     | PRC                                     | configuration file
    port                       | 5432                                    | 5432                                    | command line
    application_name           | psql                                    | psql                                    | client
    lc_numeric                 | en_US.UTF-8                             | en_US.UTF-8                             | configuration file
    wal_buffers                | 512                                     | 512                                     | override
    lc_ctype                   | en_US.UTF-8                             | en_US.UTF-8                             | override
    data_checksums             | off                                     | off                                     | override
    client_encoding            | UTF8                                    | UTF8                                    | client
    config_file                | /var/lib/pgsql/9.3/data/postgresql.conf | /var/lib/pgsql/9.3/data/postgresql.conf | override
    transaction_deferrable     | off                                     | off                                     | override
    lc_collate                 | en_US.UTF-8                             | en_US.UTF-8                             | override
    log_rotation_size          | 0                                       | 0                                       | configuration file
    log_filename               | postgresql-%a.log                       | postgresql-%a.log                       | configuration file
    lc_messages                | en_US.UTF-8                             | en_US.UTF-8                             | configuration file
    transaction_isolation      | read committed                          | read committed                          | override
    default_text_search_config | pg_catalog.english                      | pg_catalog.english                      | configuration file
    server_encoding            | UTF8                                    | UTF8                                    | override
    log_directory              | pg_log                                  | pg_log                                  | configuration file
    transaction_read_only      | off                                     | off                                     | override
    lc_monetary                | en_US.UTF-8                             | en_US.UTF-8                             | configuration file
    logging_collector          | on                                      | on                                      | configuration file
    log_line_prefix            |                                  |                                  | configuration file
    DateStyle                  | ISO, MDY                                | ISO, MDY                                | configuration file
    shared_buffers             | 16384                                   | 16384                                   | configuration file
    data_directory             | /var/lib/pgsql/9.3/data                 | /var/lib/pgsql/9.3/data                 | override
    log_timezone               | PRC                                     | PRC                                     | configuration file
    (34 rows)


    This report is saved as /tmp/pgstatreport_zabbix_1_2.txt

    /root/pgstatspack


相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
15天前
|
存储 监控 关系型数据库
轻松入门Mysql:MySQL性能优化与监控,解锁进销存系统的潜力(23)
轻松入门Mysql:MySQL性能优化与监控,解锁进销存系统的潜力(23)
|
27天前
|
SQL 监控 关系型数据库
MySQL性能调优:监控和优化
MySQL性能调优:监控和优化
52 1
|
2月前
|
监控 关系型数据库 MySQL
HeartBeat监控Mysql状态
HeartBeat监控Mysql状态
|
7月前
|
监控 关系型数据库 Shell
用shell脚本编写一个监控rds数据库外发到钉钉群的脚本
用shell脚本编写一个监控rds数据库外发到钉钉群的脚本
105 1
|
6月前
|
监控 关系型数据库 MySQL
企业实战(8)CentOS 6.8安装Zabbix-agent 5.0监控主机性能与Mysql数据库
企业实战(8)CentOS 6.8安装Zabbix-agent 5.0监控主机性能与Mysql数据库
|
2月前
|
监控 关系型数据库 MySQL
MetricBeat监控MySQL
MetricBeat监控MySQL
|
2月前
|
存储 监控 关系型数据库
ELK架构监控MySQL慢日志
ELK架构监控MySQL慢日志
|
2月前
|
SQL 监控 关系型数据库
rds迁移过程监控
rds迁移过程监控
20 1
|
2月前
|
监控 关系型数据库 MySQL
MySQL技能完整学习列表12、性能优化——1、性能指标和监控——2、优化查询和数据库结构——3、硬件和配置优化
MySQL技能完整学习列表12、性能优化——1、性能指标和监控——2、优化查询和数据库结构——3、硬件和配置优化
142 0
|
2月前
|
监控 关系型数据库 MySQL
PHP与MySQL的结合:实现局域网上网行为监控软件的数据库管理
在当今信息化时代,网络安全日益成为重要的话题。为了有效监控和管理局域网上网行为,开发一个基于PHP和MySQL的数据库管理系统是一个理想的选择。本文将介绍如何结合PHP和MySQL,开发一款简单而高效的局域网上网行为监控软件,并重点关注数据库管理方面的实现。
184 0