Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit249d936

Browse files
committed
Rename pg_restore -m to -j, and add documentation about what good numbers
are. per discussion on hackers
1 parent753a040 commit249d936

File tree

4 files changed

+56
-38
lines changed

4 files changed

+56
-38
lines changed

‎doc/src/sgml/ref/pg_restore.sgml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.80 2009/02/26 16:02:37 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.81 2009/03/20 09:21:08 petere Exp $ -->
22

33
<refentry id="APP-PGRESTORE">
44
<refmeta>
@@ -215,6 +215,46 @@
215215
</listitem>
216216
</varlistentry>
217217

218+
<varlistentry>
219+
<term><option>-j <replaceable class="parameter">number-of-jobs</replaceable></option></term>
220+
<term><option>--jobs=<replaceable class="parameter">number-of-jobs</replaceable></option></term>
221+
<listitem>
222+
<para>
223+
Run the most time-consuming parts
224+
of <application>pg_restore</> &mdash; those which load data,
225+
create indexes, or create constraints &mdash; using multiple
226+
concurrent jobs. This option can dramatically reduce the time
227+
to restore a large database to a server running on a
228+
multi-processor machine.
229+
</para>
230+
231+
<para>
232+
Each job is one process or one thread, depending on the
233+
operating system, and uses a separate connection to the
234+
server.
235+
</para>
236+
237+
<para>
238+
The optimal value for this option depends on the hardware
239+
setup of the server, of the client, and of the network.
240+
Factors include the number of CPU cores and the disk setup. A
241+
good place to start is the number of CPU cores on the server,
242+
but values larger than that can also lead to faster restore
243+
times in many cases. Of course, values that are too high will
244+
lead to decreasing performance because of thrashing.
245+
</para>
246+
247+
<para>
248+
Only the custom archive format is supported with this option.
249+
The input file must be a regular file (not, for example, a
250+
pipe). This option is ignored when emitting a script rather
251+
than connecting directly to a database server. Also, multiple
252+
jobs cannot be used together with the
253+
option <option>--single-transaction</option>.
254+
</para>
255+
</listitem>
256+
</varlistentry>
257+
218258
<varlistentry>
219259
<term><option>-l</option></term>
220260
<term><option>--list</option></term>
@@ -241,28 +281,6 @@
241281
</listitem>
242282
</varlistentry>
243283

244-
<varlistentry>
245-
<term><option>-m <replaceable class="parameter">number-of-threads</replaceable></option></term>
246-
<term><option>--multi-thread=<replaceable class="parameter">number-of-threads</replaceable></option></term>
247-
<listitem>
248-
<para>
249-
Run the most time-consuming parts of <application>pg_restore</>
250-
&mdash; those which load data, create indexes, or create
251-
constraints &mdash; using multiple concurrent connections to the
252-
database. This option can dramatically reduce the time to restore a
253-
large database to a server running on a multi-processor machine.
254-
</para>
255-
256-
<para>
257-
This option is ignored when emitting a script rather than connecting
258-
directly to a database server. Multiple threads cannot be used
259-
together with <option>--single-transaction</option>. Also, the input
260-
must be a plain file (not, for example, a pipe), and at present only
261-
the custom archive format is supported.
262-
</para>
263-
</listitem>
264-
</varlistentry>
265-
266284
<varlistentry>
267285
<term><option>-n <replaceable class="parameter">namespace</replaceable></option></term>
268286
<term><option>--schema=<replaceable class="parameter">schema</replaceable></option></term>

‎src/bin/pg_dump/pg_backup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.50 2009/02/26 16:02:37 petere Exp $
18+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.51 2009/03/20 09:21:08 petere Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -139,7 +139,7 @@ typedef struct _restoreOptions
139139
intsuppressDumpWarnings;/* Suppress output of WARNING entries
140140
* to stderr */
141141
boolsingle_txn;
142-
intnumber_of_threads;
142+
intnumber_of_jobs;
143143

144144
bool*idWanted;/* array showing which dump IDs to emit */
145145
}RestoreOptions;

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.167 2009/03/13 22:50:44 tgl Exp $
18+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.168 2009/03/20 09:21:08 petere Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -354,7 +354,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
354354
*
355355
* In parallel mode, turn control over to the parallel-restore logic.
356356
*/
357-
if (ropt->number_of_threads>1&&ropt->useDB)
357+
if (ropt->number_of_jobs>1&&ropt->useDB)
358358
restore_toc_entries_parallel(AH);
359359
else
360360
{
@@ -3061,7 +3061,7 @@ static void
30613061
restore_toc_entries_parallel(ArchiveHandle*AH)
30623062
{
30633063
RestoreOptions*ropt=AH->ropt;
3064-
intn_slots=ropt->number_of_threads;
3064+
intn_slots=ropt->number_of_jobs;
30653065
ParallelSlot*slots;
30663066
intwork_status;
30673067
intnext_slot;

‎src/bin/pg_dump/pg_restore.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
*
3636
* IDENTIFICATION
37-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.95 2009/03/11 03:33:29 adunstan Exp $
37+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.96 2009/03/20 09:21:09 petere Exp $
3838
*
3939
*-------------------------------------------------------------------------
4040
*/
@@ -93,8 +93,8 @@ main(int argc, char **argv)
9393
{"host",1,NULL,'h'},
9494
{"ignore-version",0,NULL,'i'},
9595
{"index",1,NULL,'I'},
96+
{"jobs",1,NULL,'j'},
9697
{"list",0,NULL,'l'},
97-
{"multi-thread",1,NULL,'m'},
9898
{"no-privileges",0,NULL,'x'},
9999
{"no-acl",0,NULL,'x'},
100100
{"no-owner",0,NULL,'O'},
@@ -146,7 +146,7 @@ main(int argc, char **argv)
146146
}
147147
}
148148

149-
while ((c=getopt_long(argc,argv,"acCd:ef:F:h:iI:lL:m:n:Op:P:RsS:t:T:U:vwWxX:1",
149+
while ((c=getopt_long(argc,argv,"acCd:ef:F:h:iI:j:lL:n:Op:P:RsS:t:T:U:vwWxX:1",
150150
cmdopts,NULL))!=-1)
151151
{
152152
switch (c)
@@ -181,6 +181,10 @@ main(int argc, char **argv)
181181
/* ignored, deprecated option */
182182
break;
183183

184+
case'j':/* number of restore jobs */
185+
opts->number_of_jobs=atoi(optarg);
186+
break;
187+
184188
case'l':/* Dump the TOC summary */
185189
opts->tocSummary=1;
186190
break;
@@ -189,10 +193,6 @@ main(int argc, char **argv)
189193
opts->tocFile=strdup(optarg);
190194
break;
191195

192-
case'm':/* number of restore threads */
193-
opts->number_of_threads=atoi(optarg);
194-
break;
195-
196196
case'n':/* Dump data for this schema only */
197197
opts->schemaNames=strdup(optarg);
198198
break;
@@ -318,9 +318,9 @@ main(int argc, char **argv)
318318
}
319319

320320
/* Can't do single-txn mode with multiple connections */
321-
if (opts->single_txn&&opts->number_of_threads>1)
321+
if (opts->single_txn&&opts->number_of_jobs>1)
322322
{
323-
fprintf(stderr,_("%s: cannot specify both --single-transaction and multiplethreads\n"),
323+
fprintf(stderr,_("%s: cannot specify both --single-transaction and multiplejobs\n"),
324324
progname);
325325
exit(1);
326326
}
@@ -417,9 +417,9 @@ usage(const char *progname)
417417
printf(_(" -C, --create create the target database\n"));
418418
printf(_(" -e, --exit-on-error exit on error, default is to continue\n"));
419419
printf(_(" -I, --index=NAME restore named index\n"));
420+
printf(_(" -j, --jobs=NUM use this many parallel jobs to restore\n"));
420421
printf(_(" -L, --use-list=FILENAME use table of contents from this file for\n"
421422
" selecting/ordering output\n"));
422-
printf(_(" -m, --multi-thread=NUM use this many parallel connections to restore\n"));
423423
printf(_(" -n, --schema=NAME restore only objects in this schema\n"));
424424
printf(_(" -O, --no-owner skip restoration of object ownership\n"));
425425
printf(_(" -P, --function=NAME(args)\n"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp