@@ -469,6 +469,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
469
469
470
470
471
471
472
+ |
473
+
474
+
475
+ One row for each combination of backend type, context, and target object
476
+ containing cluster-wide I/O statistics.
477
+ See
478
+ pg_stat_io for details.
479
+
480
+
481
+
472
482
|
473
483
pg_stat_replication_slots pg_stat_replication_slots
474
484
One row per replication slot, showing statistics about the
@@ -665,20 +675,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
665
675
666
676
667
677
668
- The pg_statio_ views are primarily useful to
669
- determine the effectiveness of the buffer cache. When the number
670
- of actual disk reads is much smaller than the number of buffer
671
- hits, then the cache is satisfying most read requests without
672
- invoking a kernel call. However, these statistics do not give the
673
- entire story: due to the way in which
PostgreSQL
674
- handles disk I/O, data that is not in the
675
- PostgreSQL buffer cache might still reside in the
676
- kernel's I/O cache, and might therefore still be fetched without
677
- requiring a physical read. Users interested in obtaining more
678
- detailed information on
PostgreSQL I/O behavior are
679
- advised to use the
PostgreSQL statistics views
680
- in combination with operating system utilities that allow insight
681
- into the kernel's handling of I/O.
678
+ The pg_stat_io and
679
+ pg_statio_ set of views are useful for determining
680
+ the effectiveness of the buffer cache. They can be used to calculate a cache
681
+ hit ratio. Note that while
PostgreSQL 's I/O
682
+ statistics capture most instances in which the kernel was invoked in order
683
+ to perform I/O, they do not differentiate between data which had to be
684
+ fetched from disk and that which already resided in the kernel page cache.
685
+ Users are advised to use the
PostgreSQL
686
+ statistics views in combination with operating system utilities for a more
687
+ complete picture of their database's I/O performance.
682
688
683
689
684
690
@@ -3669,6 +3675,293 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
3669
3675
last_archived_wal have also been successfully
3670
3676
archived.
3671
3677
3678
+
3679
+
3680
+
3681
+
pg_stat_io
3682
+
3683
+
3684
+
3685
+
3686
+
3687
+
3688
+ The pg_stat_io view will contain one row for each
3689
+ combination of backend type, target I/O object, and I/O context, showing
3690
+ cluster-wide I/O statistics. Combinations which do not make sense are
3691
+ omitted.
3692
+
3693
+
3694
+
3695
+ Currently, I/O on relations (e.g. tables, indexes) is tracked. However,
3696
+ relation I/O which bypasses shared buffers (e.g. when moving a table from one
3697
+ tablespace to another) is currently not tracked.
3698
+
3699
+
3700
+
3701
+
pg_stat_io View
3702
+
3703
+
3704
+ |
3705
+
3706
+
3707
+ Column Type
3708
+
3709
+
3710
+ Description
3711
+
3712
+
3713
+
3714
+
3715
+
3716
+ |
3717
+
3718
+
3719
+ backend_type text
3720
+
3721
+
3722
+ Type of backend (e.g. background worker, autovacuum worker). See
3723
+ linkend="monitoring-pg-stat-activity-view">
3724
+ pg_stat_activity for more information
3725
+ on backend_type s. Some
3726
+ backend_type s do not accumulate I/O operation
3727
+ statistics and will not be included in the view.
3728
+
3729
+
3730
+
3731
+
3732
+ |
3733
+
3734
+
3735
+ io_object text
3736
+
3737
+
3738
+ Target object of an I/O operation. Possible values are:
3739
+
3740
+
3741
+
3742
+ relation : Permanent relations.
3743
+
3744
+
3745
+
3746
+
3747
+ temp relation : Temporary relations.
3748
+
3749
+
3750
+
3751
+
3752
+
3753
+
3754
+
3755
+ |
3756
+
3757
+
3758
+ io_context text
3759
+
3760
+
3761
+ The context of an I/O operation. Possible values are:
3762
+
3763
+
3764
+
3765
+
3766
+ normal : The default or standard
3767
+ io_context for a type of I/O operation. For
3768
+ example, by default, relation data is read into and written out from
3769
+ shared buffers. Thus, reads and writes of relation data to and from
3770
+ shared buffers are tracked in io_context
3771
+ normal .
3772
+
3773
+
3774
+
3775
+
3776
+ vacuum : I/O operations performed outside of shared
3777
+ buffers while vacuuming and analyzing permanent relations. Temporary
3778
+ table vacuums use the same local buffer pool as other temporary table
3779
+ IO operations and are tracked in io_context
3780
+ normal .
3781
+
3782
+
3783
+
3784
+
3785
+ bulkread : Certain large read I/O operations
3786
+ done outside of shared buffers, for example, a sequential scan of a
3787
+ large table.
3788
+
3789
+
3790
+
3791
+
3792
+ bulkwrite : Certain large write I/O operations
3793
+ done outside of shared buffers, such as COPY .
3794
+
3795
+
3796
+
3797
+
3798
+
3799
+
3800
+ |
3801
+
3802
+
3803
+ reads bigint
3804
+
3805
+
3806
+ Number of read operations, each of the size specified in
3807
+ op_bytes .
3808
+
3809
+
3810
+
3811
+
3812
+ |
3813
+
3814
+
3815
+ writes bigint
3816
+
3817
+
3818
+ Number of write operations, each of the size specified in
3819
+ op_bytes .
3820
+
3821
+
3822
+
3823
+
3824
+ |
3825
+
3826
+
3827
+ extends bigint
3828
+
3829
+
3830
+ Number of relation extend operations, each of the size specified in
3831
+ op_bytes .
3832
+
3833
+
3834
+
3835
+
3836
+ |
3837
+
3838
+
3839
+ op_bytes bigint
3840
+
3841
+
3842
+ The number of bytes per unit of I/O read, written, or extended.
3843
+
3844
+
3845
+ Relation data reads, writes, and extends are done in
3846
+ block_size units, derived from the build-time
3847
+ parameter BLCKSZ , which is 8192 by
3848
+ default.
3849
+
3850
+
3851
+
3852
+
3853
+ |
3854
+
3855
+
3856
+ evictions bigint
3857
+
3858
+
3859
+ Number of times a block has been written out from a shared or local
3860
+ buffer in order to make it available for another use.
3861
+
3862
+
3863
+ In io_context normal , this counts
3864
+ the number of times a block was evicted from a buffer and replaced with
3865
+ another block. In io_context s
3866
+ bulkwrite , bulkread , and
3867
+ vacuum , this counts the number of times a block was
3868
+ evicted from shared buffers in order to add the shared buffer to a
3869
+ separate, size-limited ring buffer for use in a bulk I/O operation.
3870
+
3871
+
3872
+
3873
+
3874
+ |
3875
+
3876
+
3877
+ reuses bigint
3878
+
3879
+
3880
+ The number of times an existing buffer in a size-limited ring buffer
3881
+ outside of shared buffers was reused as part of an I/O operation in the
3882
+ bulkread , bulkwrite , or
3883
+ vacuum io_context s.
3884
+
3885
+
3886
+
3887
+
3888
+ |
3889
+
3890
+
3891
+ fsyncs bigint
3892
+
3893
+
3894
+ Number of fsync calls. These are only tracked in
3895
+ io_context normal .
3896
+
3897
+
3898
+
3899
+
3900
+ |
3901
+
3902
+
3903
+ stats_reset timestamp with time zone
3904
+
3905
+
3906
+ Time at which these statistics were last reset.
3907
+
3908
+
3909
+
3910
+
3911
+
3912
+
3913
+
3914
+
3915
+ Some backend types never perform I/O operations on some I/O objects and/or
3916
+ in some I/O contexts. These rows are omitted from the view. For example, the
3917
+ checkpointer does not checkpoint temporary tables, so there will be no rows
3918
+ for backend_type checkpointer and
3919
+ io_object temp relation .
3920
+
3921
+
3922
+
3923
+ In addition, some I/O operations will never be performed either by certain
3924
+ backend types or on certain I/O objects and/or in certain I/O contexts.
3925
+ These cells will be NULL. For example, temporary tables are not
3926
+ fsync ed, so fsyncs will be NULL for
3927
+ io_object temp relation . Also, the
3928
+ background writer does not perform reads, so reads will
3929
+ be NULL in rows for backend_type background
3930
+ writer.
3931
+
3932
+
3933
+
3934
+ pg_stat_io can be used to inform database tuning.
3935
+ For example:
3936
+
3937
+
3938
+
3939
+ A high evictions count can indicate that shared
3940
+ buffers should be increased.
3941
+
3942
+
3943
+
3944
+
3945
+ Client backends rely on the checkpointer to ensure data is persisted to
3946
+ permanent storage. Large numbers of fsyncs by
3947
+ client backend s could indicate a misconfiguration of
3948
+ shared buffers or of the checkpointer. More information on configuring
3949
+ the checkpointer can be found in .
3950
+
3951
+
3952
+
3953
+
3954
+ Normally, client backends should be able to rely on auxiliary processes
3955
+ like the checkpointer and the background writer to write out dirty data
3956
+ as much as possible. Large numbers of writes by client backends could
3957
+ indicate a misconfiguration of shared buffers or of the checkpointer.
3958
+ More information on configuring the checkpointer can be found in
3959
+ linkend="wal-configuration"/>.
3960
+
3961
+
3962
+
3963
+
3964
+
3672
3965
3673
3966
3674
3967
0 commit comments