@@ -5,50 +5,13 @@ pg_repack -- Reorganize tables in PostgreSQL databases without any locks
5
5
:depth: 1
6
6
:backlinks: none
7
7
8
- Synopsis
9
- --------
10
-
11
- ::
12
-
13
- pg_repack [OPTION]... [DBNAME]
14
-
15
- The following options can be specified in ``OPTIONS ``. See also Options _ for
16
- details.
17
-
18
- Options:
19
- -a, --all repack all databases
20
- -n, --no-order do vacuum full instead of cluster
21
- -o, --order-by=COLUMNS order by columns instead of cluster keys
22
- -t, --table=TABLE repack specific table only
23
- -T, --wait-timeout=SECS timeout to cancel other backends on conflict
24
- -Z, --no-analyze don't analyze at end
25
-
26
- Connection options:
27
- -d, --dbname=DBNAME database to connect
28
- -h, --host=HOSTNAME database server host or socket directory
29
- -p, --port=PORT database server port
30
- -U, --username=USERNAME user name to connect as
31
- -w, --no-password never prompt for password
32
- -W, --password force password prompt
33
-
34
- Generic options:
35
- -e, --echo echo queries
36
- -E, --elevel=LEVEL set output message level
37
- --help show this help, then exit
38
- --version output version information, then exit
39
-
40
-
41
- Description
42
- -----------
43
8
44
9
pg_repack _ is an utility program to reorganize tables in PostgreSQL databases.
45
10
Unlike clusterdb _, it doesn't block any selections and updates during
46
11
reorganization.
47
12
48
- pg_repack is a fork of the previous pg_reorg _ project. It was founded to
49
- gather the bug fixes and new development ideas that the slow pace of
50
- development of pg_reorg was struggling to satisfy. Please check the `project
51
- page `_ for bug report and development information.
13
+ pg_repack is a fork of the previous pg_reorg _ project. Please check the
14
+ `project page `_ for bug report and development information.
52
15
53
16
You can choose one of the following methods to reorganize:
54
17
@@ -68,24 +31,89 @@ NOTICE:
68
31
.. _pg_reorg : http://reorg.projects.pgfoundry.org/
69
32
70
33
71
- Examples
72
- --------
34
+ Requirements
35
+ ------------
73
36
74
- Execute the following command to perform an online CLUSTER of all tables in
75
- test database::
37
+ PostgreSQL versions
38
+ PostgreSQL 8.3, 8.4, 9.0, 9.1, 9.2
76
39
77
- $ pg_repack test
40
+ OS
41
+ RHEL 5.2, Windows XP SP3
78
42
79
- Execute the following command to perform an online VACUUM FULL to foo table in
80
- test database::
43
+ Disks
44
+ Requires free disk space twice as large as the target table(s) and
45
+ indexes. For example, if the total size of the tables and indexes to be
46
+ reorganized is 1GB, an additional 2GB of disk space is required.
81
47
82
- $ pg_repack --no-order --table foo -d test
83
48
49
+ Installation
50
+ ------------
51
+
52
+ pg_repack can be built with ``make `` on UNIX or Linux. The PGXS build
53
+ framework is used automatically. Before building, you might need to install
54
+ the PostgreSQL development packages (``postgresql-devel ``, etc.) and add the
55
+ directory containing ``pg_config `` to your ``$PATH ``. Then you can run::
84
56
85
- Options
86
- -------
57
+ $ cd pg_repack
58
+ $ make
59
+ $ sudo make install
60
+
61
+ You can also use Microsoft Visual C++ 2010 to build the program on Windows.
62
+ There are project files in the ``msvc `` folder.
63
+
64
+ After installation, load the pg_repack extension in the database you want to
65
+ process. On PostgreSQL 9.1 and following pg_repack is packaged as an
66
+ extension, so you can execute::
67
+
68
+ $ psql -c "CREATE EXTENSION pg_repack" -d your_database
69
+
70
+ For previous PostgreSQL versions you should load the script
71
+ ``$SHAREDIR/contrib/pg_repack.sql `` in the database to process; you can
72
+ get ``$SHAREDIR `` using ``pg_config --sharedir ``, e.g. ::
73
+
74
+ $ psql -f "$(pg_config --sharedir)/contrib/pg_repack.sql" -d your_database
75
+
76
+ You can remove pg_repack from a PostgreSQL 9.1 and following database using
77
+ ``DROP EXTENSION pg_repack ``. For previous Postgresql versions load the
78
+ ``$SHAREDIR/contrib/uninstall_pg_repack.sql `` script or just drop the
79
+ ``repack `` schema.
80
+
81
+ If you are upgrading from a previous version of pg_repack or pg_reorg, just
82
+ drop the old version from the database as explained above and install the new
83
+ version.
84
+
85
+
86
+ Usage
87
+ -----
88
+
89
+ ::
90
+
91
+ pg_repack [OPTION]... [DBNAME]
92
+
93
+ The following options can be specified in ``OPTIONS ``.
94
+
95
+ Options:
96
+ -a, --all repack all databases
97
+ -n, --no-order do vacuum full instead of cluster
98
+ -o, --order-by=COLUMNS order by columns instead of cluster keys
99
+ -t, --table=TABLE repack specific table only
100
+ -T, --wait-timeout=SECS timeout to cancel other backends on conflict
101
+ -Z, --no-analyze don't analyze at end
102
+
103
+ Connection options:
104
+ -d, --dbname=DBNAME database to connect
105
+ -h, --host=HOSTNAME database server host or socket directory
106
+ -p, --port=PORT database server port
107
+ -U, --username=USERNAME user name to connect as
108
+ -w, --no-password never prompt for password
109
+ -W, --password force password prompt
110
+
111
+ Generic options:
112
+ -e, --echo echo queries
113
+ -E, --elevel=LEVEL set output message level
114
+ --help show this help, then exit
115
+ --version output version information, then exit
87
116
88
- pg_repack has the following command line options:
89
117
90
118
Reorg Options
91
119
^^^^^^^^^^^^^
@@ -190,6 +218,20 @@ Environment
190
218
.. __ : http://www.postgresql.org/docs/current/static/libpq-envars.html
191
219
192
220
221
+ Examples
222
+ --------
223
+
224
+ Execute the following command to perform an online CLUSTER of all tables in
225
+ test database::
226
+
227
+ $ pg_repack test
228
+
229
+ Execute the following command to perform an online VACUUM FULL to foo table in
230
+ test database::
231
+
232
+ $ pg_repack --no-order --table foo -d test
233
+
234
+
193
235
Diagnostics
194
236
-----------
195
237
@@ -294,58 +336,6 @@ table. Then, it updates the system catalogs directly to swap the work table
294
336
and the original one.
295
337
296
338
297
- Installation
298
- ------------
299
-
300
- pg_repack can be built with ``make `` on UNIX or Linux. The PGXS build
301
- framework is used automatically. Before building, you might need to install
302
- the PostgreSQL development packages (``postgresql-devel ``, etc.) and add the
303
- directory containing ``pg_config `` to your ``$PATH ``. Then you can run::
304
-
305
- $ cd pg_repack
306
- $ make
307
- $ sudo make install
308
-
309
- You can also use Microsoft Visual C++ 2010 to build the program on Windows.
310
- There are project files in the ``msvc `` folder.
311
-
312
- After installation, load the pg_repack extension in the database you want to
313
- process. On PostgreSQL 9.1 and following pg_repack is packaged as an
314
- extension, so you can execute::
315
-
316
- $ psql -c "CREATE EXTENSION pg_repack" -d your_database
317
-
318
- For previous PostgreSQL versions you should load the script
319
- ``$SHAREDIR/contrib/pg_repack.sql `` in the database to process; you can
320
- get ``$SHAREDIR `` using ``pg_config --sharedir ``, e.g. ::
321
-
322
- $ psql -f "$(pg_config --sharedir)/contrib/pg_repack.sql" -d your_database
323
-
324
- You can remove pg_repack from a PostgreSQL 9.1 and following database using
325
- ``DROP EXTENSION pg_repack ``. For previous Postgresql versions load the
326
- ``$SHAREDIR/contrib/uninstall_pg_repack.sql `` script or just drop the
327
- ``repack `` schema.
328
-
329
- If you are upgrading from a previous version of pg_repack or pg_reorg, just
330
- drop the old version from the database as explained above and install the new
331
- version.
332
-
333
-
334
- Requirements
335
- ------------
336
-
337
- PostgreSQL versions
338
- PostgreSQL 8.3, 8.4, 9.0, 9.1, 9.2
339
-
340
- OS
341
- RHEL 5.2, Windows XP SP3
342
-
343
- Disks
344
- Requires free disk space twice as large as the target table(s) and
345
- indexes. For example, if the total size of the tables and indexes to be
346
- reorganized is 1GB, an additional 2GB of disk space is required.
347
-
348
-
349
339
Releases
350
340
--------
351
341
0 commit comments