Postgresql – How to configure postgresql-9.2 to know blk_write_time in pg_stat_database

postgresql-9.2statistics

Interested in the procedure for collecting block write statistics of PostgreSQL 9.2.

Steps followed for configuration, could get blk_read time but not blk_write_time

  1. CREATE EXTENSION adminpack; and CREATE EXTENSION dblink;
  2. Changed postgresql.conf file

    # - Query/Index Statistics Collector -
    
    track_activities = on
    track_counts = on
    track_io_timing = on
    track_functions = all           # none, pl, all
    track_activity_query_size = 1024    # (change requires restart)
    update_process_title = on
    stats_temp_directory = 'pg_stat_tmp'
    
    # - Background Writer -
    
    bgwriter_delay = 200ms          # 10-10000ms between rounds
    bgwriter_lru_maxpages = 100     # 0-1000 max buffers written/round
    bgwriter_lru_multiplier = 2.0       # 0-10.0 multipler on buffers scanned/round
    
  3. Restarted Postgres Server

  4. Performed around 2000 inserts to table
  5. But could not view the blk_write_time.

Best Answer

configuration above is correct. Before viewing the blk_write_time, do a vacuum. If you still see a 0 try increasing the inserts from 2000 to say 1000000.

Step 5: vacuum; Step 6: select datname, blk_write_time from pg_stat_database;