File tree Expand file tree Collapse file tree 1 file changed +28
-6
lines changed Expand file tree Collapse file tree 1 file changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -429,13 +429,35 @@ earlier versions which could result in data corruption.
429
429
Details
430
430
-------
431
431
432
- To perform full table repacks, pg_repack creates a work table in the "repack"
433
- schema and sorts the rows in this table. Then, it updates the system catalogs
434
- directly to swap the work table and the original one.
432
+ Full table repack
433
+ ^^^^^^^^^^^^^^^^^
435
434
436
- To perform index only repacks, pg_repack creates its work index on the target
437
- table and then updates the system catalogs directly to swap the work index and
438
- the original index.
435
+ To perform a full table repack, pg_repack will:
436
+
437
+ * create a log table for changes
438
+ * create a trigger on the old table to log all changes to the 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
+ * switch all table files in the system catalog
443
+ * drop the old table
444
+
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.
447
+
448
+
449
+ Index only repack
450
+ ^^^^^^^^^^^^^^^^^
451
+
452
+ To perform a index only repack, pg_repack will:
453
+
454
+ * create a new index on the table using CONCURRENTLY
455
+ * swap the index in the catalog
456
+ * drop the old index
457
+
458
+ Creating indexes concurrently comes with a few caveats, please see `the documentation `__ for details.
459
+
460
+ .. __ : http://www.postgresql.org/docs/current/static/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY
439
461
440
462
441
463
Releases
You can’t perform that action at this time.
0 commit comments