@@ -627,6 +627,15 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
627
627
</entry>
628
628
</row>
629
629
630
+ <row>
631
+ <entry><structname>pg_stat_subscription_workers</structname><indexterm><primary>pg_stat_subscription_workers</primary></indexterm></entry>
632
+ <entry>One row per subscription worker, showing statistics about errors
633
+ that occurred on that subscription worker.
634
+ See <link linkend="monitoring-pg-stat-subscription-workers">
635
+ <structname>pg_stat_subscription_workers</structname></link> for details.
636
+ </entry>
637
+ </row>
638
+
630
639
</tbody>
631
640
</tgroup>
632
641
</table>
@@ -3054,6 +3063,128 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
3054
3063
3055
3064
</sect2>
3056
3065
3066
+ <sect2 id="monitoring-pg-stat-subscription-workers">
3067
+ <title><structname>pg_stat_subscription_workers</structname></title>
3068
+
3069
+ <indexterm>
3070
+ <primary>pg_stat_subscription_workers</primary>
3071
+ </indexterm>
3072
+
3073
+ <para>
3074
+ The <structname>pg_stat_subscription_workers</structname> view will contain
3075
+ one row per subscription worker on which errors have occurred, for workers
3076
+ applying logical replication changes and workers handling the initial data
3077
+ copy of the subscribed tables. The statistics entry is removed when the
3078
+ corresponding subscription is dropped.
3079
+ </para>
3080
+
3081
+ <table id="pg-stat-subscription-workers" xreflabel="pg_stat_subscription_workers">
3082
+ <title><structname>pg_stat_subscription_workers</structname> View</title>
3083
+ <tgroup cols="1">
3084
+ <thead>
3085
+ <row>
3086
+ <entry role="catalog_table_entry"><para role="column_definition">
3087
+ Column Type
3088
+ </para>
3089
+ <para>
3090
+ Description
3091
+ </para></entry>
3092
+ </row>
3093
+ </thead>
3094
+
3095
+ <tbody>
3096
+ <row>
3097
+ <entry role="catalog_table_entry"><para role="column_definition">
3098
+ <structfield>subid</structfield> <type>oid</type>
3099
+ </para>
3100
+ <para>
3101
+ OID of the subscription
3102
+ </para></entry>
3103
+ </row>
3104
+
3105
+ <row>
3106
+ <entry role="catalog_table_entry"><para role="column_definition">
3107
+ <structfield>subname</structfield> <type>name</type>
3108
+ </para>
3109
+ <para>
3110
+ Name of the subscription
3111
+ </para></entry>
3112
+ </row>
3113
+
3114
+ <row>
3115
+ <entry role="catalog_table_entry"><para role="column_definition">
3116
+ <structfield>subrelid</structfield> <type>oid</type>
3117
+ </para>
3118
+ <para>
3119
+ OID of the relation that the worker is synchronizing; null for the
3120
+ main apply worker
3121
+ </para></entry>
3122
+ </row>
3123
+
3124
+ <row>
3125
+ <entry role="catalog_table_entry"><para role="column_definition">
3126
+ <structfield>last_error_relid</structfield> <type>oid</type>
3127
+ </para>
3128
+ <para>
3129
+ OID of the relation that the worker was processing when the
3130
+ error occurred
3131
+ </para></entry>
3132
+ </row>
3133
+
3134
+ <row>
3135
+ <entry role="catalog_table_entry"><para role="column_definition">
3136
+ <structfield>last_error_command</structfield> <type>text</type>
3137
+ </para>
3138
+ <para>
3139
+ Name of command being applied when the error occurred. This field
3140
+ is null if the error was reported during the initial data copy.
3141
+ </para></entry>
3142
+ </row>
3143
+
3144
+ <row>
3145
+ <entry role="catalog_table_entry"><para role="column_definition">
3146
+ <structfield>last_error_xid</structfield> <type>xid</type>
3147
+ </para>
3148
+ <para>
3149
+ Transaction ID of the publisher node being applied when the error
3150
+ occurred. This field is null if the error was reported
3151
+ during the initial data copy.
3152
+ </para></entry>
3153
+ </row>
3154
+
3155
+ <row>
3156
+ <entry role="catalog_table_entry"><para role="column_definition">
3157
+ <structfield>last_error_count</structfield> <type>uint8</type>
3158
+ </para>
3159
+ <para>
3160
+ Number of consecutive times the error occurred
3161
+ </para></entry>
3162
+ </row>
3163
+
3164
+ <row>
3165
+ <entry role="catalog_table_entry"><para role="column_definition">
3166
+ <structfield>last_error_message</structfield> <type>text</type>
3167
+ </para>
3168
+ <para>
3169
+ The error message
3170
+ </para></entry>
3171
+ </row>
3172
+
3173
+ <row>
3174
+ <entry role="catalog_table_entry"><para role="column_definition">
3175
+ <structfield>last_error_time</structfield> <type>timestamp with time zone</type>
3176
+ </para>
3177
+ <para>
3178
+ Last time at which this error occurred
3179
+ </para></entry>
3180
+ </row>
3181
+
3182
+ </tbody>
3183
+ </tgroup>
3184
+ </table>
3185
+
3186
+ </sect2>
3187
+
3057
3188
<sect2 id="monitoring-pg-stat-ssl-view">
3058
3189
<title><structname>pg_stat_ssl</structname></title>
3059
3190
@@ -5176,6 +5307,32 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
5176
5307
can be granted EXECUTE to run the function.
5177
5308
</para></entry>
5178
5309
</row>
5310
+
5311
+ <row>
5312
+ <entry role="func_table_entry"><para role="func_signature">
5313
+ <indexterm>
5314
+ <primary>pg_stat_reset_subscription_worker</primary>
5315
+ </indexterm>
5316
+ <function>pg_stat_reset_subscription_worker</function> ( <parameter>subid</parameter> <type>oid</type> <optional>, <parameter>relid</parameter> <type>oid</type> </optional> )
5317
+ <returnvalue>void</returnvalue>
5318
+ </para>
5319
+ <para>
5320
+ Resets the statistics of subscription workers running on the
5321
+ subscription with <parameter>subid</parameter> shown in the
5322
+ <structname>pg_stat_subscription_workers</structname> view. If the
5323
+ argument <parameter>relid</parameter> is not <literal>NULL</literal>,
5324
+ resets statistics of the subscription worker handling the initial data
5325
+ copy of the relation with <parameter>relid</parameter>. Otherwise,
5326
+ resets the subscription worker statistics of the main apply worker.
5327
+ If the argument <parameter>relid</parameter> is omitted, resets the
5328
+ statistics of all subscription workers running on the subscription
5329
+ with <parameter>subid</parameter>.
5330
+ </para>
5331
+ <para>
5332
+ This function is restricted to superusers by default, but other users
5333
+ can be granted EXECUTE to run the function.
5334
+ </para></entry>
5335
+ </row>
5179
5336
</tbody>
5180
5337
</tgroup>
5181
5338
</table>
0 commit comments