@@ -338,8 +338,7 @@ doc/src/sgml/pgprobackup.sgml
338338 changes on the fly. Continuous archiving is not necessary
339339 for it to operate. Each time a relation page is updated,
340340 this page is marked in a special PTRACK bitmap for this
341- relation. As one page requires just one bit in the PTRACK
342- fork, such bitmaps are quite small. Tracking implies some
341+ relation. Tracking implies some
343342 minor overhead on the database server operation, but
344343 speeds up incremental backups significantly.
345344 </para >
@@ -1150,9 +1149,69 @@ GRANT SELECT ON TABLE pg_catalog.pg_database TO backup;
11501149 </para >
11511150 <para >
11521151 If you are going to use PTRACK backups, complete the following
1153- additional steps:
1152+ additional steps. The role that will perform PTRACK backups
1153+ (the <literal >backup</literal > role in the examples below) must have
1154+ access to all the databases of the cluster.
11541155 </para >
1155- <itemizedlist >
1156+ <para >
1157+ For <productname >PostgreSQL</productname > 12 or higher:
1158+ </para >
1159+ <orderedlist >
1160+ <listitem >
1161+ <para >
1162+ Create PTRACK extension:
1163+ <programlisting >
1164+ CREATE EXTENSION ptrack;
1165+ </programlisting >
1166+ </para >
1167+ </listitem >
1168+ <listitem >
1169+ <para >
1170+ To enable tracking page updates, set <varname >ptrack_map_size</varname >
1171+ parameter to a positive integer and restart the server.
1172+ </para >
1173+ <para >
1174+ For optimal performance, it is recommended to set
1175+ <varname >ptrack_map_size</varname > to
1176+ <literal ><replaceable >N</replaceable > / 1024</literal >, where
1177+ <replaceable >N</replaceable > is the size of the
1178+ <productname >PostgreSQL</productname > cluster, in MB. If you set this
1179+ parameter to a lower value, PTRACK is more likely to map several blocks
1180+ together, which leads to false-positive results when tracking changed
1181+ blocks and increases the incremental backup size as unchanged blocks
1182+ can also be copied into the incremental backup.
1183+ Setting <varname >ptrack_map_size</varname > to a higher value
1184+ does not affect PTRACK operation. The maximum allowed value is 1024.
1185+ </para >
1186+ </listitem >
1187+ <listitem >
1188+ <para >
1189+ Grant the right to execute <application >PTRACK</application >
1190+ functions to the <literal >backup</literal > role
1191+ in the database used to connect to the cluster:
1192+ </para >
1193+ <programlisting >
1194+ GRANT EXECUTE ON FUNCTION pg_catalog.pg_ptrack_get_pagemapset(pg_lsn) TO backup;
1195+ GRANT EXECUTE ON FUNCTION pg_catalog.pg_ptrack_control_lsn() TO backup;
1196+ GRANT EXECUTE ON FUNCTION pg_catalog.pg_ptrack_get_block(oid, oid, oid, bigint) TO backup;
1197+ </programlisting >
1198+ </listitem >
1199+ </orderedlist >
1200+
1201+ <note >
1202+ <para >
1203+ If you change the <varname >ptrack_map_size</varname > parameter value,
1204+ the previously created PTRACK map file is cleared,
1205+ and tracking newly changed blocks starts from scratch. Thus, you have
1206+ to retake a full backup before taking incremental PTRACK backups after
1207+ changing <varname >ptrack_map_size</varname >.
1208+ </para >
1209+ </note >
1210+
1211+ <para >
1212+ For older <productname >PostgreSQL</productname > versions:
1213+ </para >
1214+ <orderedlist >
11561215 <listitem >
11571216 <para >
11581217 Set the <parameter >ptrack_enable</parameter > parameter to
@@ -1161,7 +1220,7 @@ GRANT SELECT ON TABLE pg_catalog.pg_database TO backup;
11611220 </listitem >
11621221 <listitem >
11631222 <para >
1164- Grant the rights to execute <application >PTRACK</application >
1223+ Grant the right to execute <application >PTRACK</application >
11651224 functions to the <literal >backup</literal > role
11661225 <emphasis role =" strong" >in every database</emphasis > of the
11671226 cluster:
@@ -1171,13 +1230,8 @@ GRANT EXECUTE ON FUNCTION pg_catalog.pg_ptrack_clear() TO backup;
11711230GRANT EXECUTE ON FUNCTION pg_catalog.pg_ptrack_get_and_clear(oid, oid) TO backup;
11721231</programlisting >
11731232 </listitem >
1174- <listitem >
1175- <para >
1176- The <literal >backup</literal > role must have access to all
1177- the databases of the cluster.
1178- </para >
1179- </listitem >
1180- </itemizedlist >
1233+ </orderedlist >
1234+
11811235 </refsect2 >
11821236</refsect1 >
11831237
0 commit comments