Skip to content

Commit 8fe2cf1

Browse files
committed
Some further fixes/cleanup/wordsmithing of the doc changes.
1 parent c375c20 commit 8fe2cf1

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

doc/pg_repack.rst

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -429,31 +429,34 @@ earlier versions which could result in data corruption.
429429
Details
430430
-------
431431

432-
Full table repack
433-
^^^^^^^^^^^^^^^^^
432+
Full Table Repacks
433+
^^^^^^^^^^^^^^^^^^
434434

435-
To perform a full table repack, pg_repack will:
435+
To perform a full-table repack, pg_repack will:
436436

437-
* create a log table
438-
* create a trigger on the old table to log all changes to the log table
439-
* create a new table containing all data in the old table
440-
* create all indexes on the new table
441-
* apply all changes from the log table to the new table
442-
* when the log table is empty, swap the table in the system catalog
443-
* drop the old table
437+
1. create a log table to record changes made to the original table
438+
2. add a trigger onto the original table, logging INSERTs, UPDATEs and DELETEs into our log table
439+
3. create a new table containing all the rows in the old table
440+
4. build indexes on this new table
441+
5. apply all changes which have accrued in the log table to the new table
442+
6. swap the tables, including indexes and toast tables, using the system catalogs
443+
7. drop the original table
444444

445-
pg_repack will only acquire ACCESS EXCLUSIVE locks when creating the trigger and when
446-
switching the table files, all other operations are lock-free on the source table.
445+
pg_repack will only hold an ACCESS EXCLUSIVE lock for a short period during
446+
initial setup (steps 1 and 2 above) and during the final swap-and-drop phase
447+
(steps 6 and 7). For the rest of its time, pg_repack only needs
448+
to hold an ACCESS SHARE lock on the original table, meaning INSERTs, UPDATEs,
449+
and DELETEs may proceed as usual.
447450

448451

449-
Index only repack
450-
^^^^^^^^^^^^^^^^^
452+
Index Only Repacks
453+
^^^^^^^^^^^^^^^^^^
451454

452-
To perform a index only repack, pg_repack will:
455+
To perform an index-only repack, pg_repack will:
453456

454-
* create a new index on the table using CONCURRENTLY
455-
* swap the index in the catalog
456-
* drop the old index
457+
1. create new indexes on the table using CONCURRENTLY matching the definitions of the old indexes
458+
2. swap out the old for the new indexes in the catalogs
459+
3. drop the old indexes
457460

458461
Creating indexes concurrently comes with a few caveats, please see `the documentation`__ for details.
459462

0 commit comments

Comments
 (0)