-
+
+
+
+
+
+ Run the most time-consuming parts
+ of
pg_restore> — those which load data,
+ create indexes, or create constraints — using multiple
+ concurrent jobs. This option can dramatically reduce the time
+ to restore a large database to a server running on a
+ multi-processor machine.
+
+
+ Each job is one process or one thread, depending on the
+ operating system, and uses a separate connection to the
+ server.
+
+
+ The optimal value for this option depends on the hardware
+ setup of the server, of the client, and of the network.
+ Factors include the number of CPU cores and the disk setup. A
+ good place to start is the number of CPU cores on the server,
+ but values larger than that can also lead to faster restore
+ times in many cases. Of course, values that are too high will
+ lead to decreasing performance because of thrashing.
+
+
+ Only the custom archive format is supported with this option.
+ The input file must be a regular file (not, for example, a
+ pipe). This option is ignored when emitting a script rather
+ than connecting directly to a database server. Also, multiple
+ jobs cannot be used together with the
+ option .
+
+
+
+
-
-
-
-
- Run the most time-consuming parts of
pg_restore>
- — those which load data, create indexes, or create
- constraints — using multiple concurrent connections to the
- database. This option can dramatically reduce the time to restore a
- large database to a server running on a multi-processor machine.
-
-
- This option is ignored when emitting a script rather than connecting
- directly to a database server. Multiple threads cannot be used
- together with . Also, the input
- must be a plain file (not, for example, a pipe), and at present only
- the custom archive format is supported.
-
-
-
-
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.167 2009/03/13 22:50:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.168 2009/03/20 09:21:08 petere Exp $
*
*-------------------------------------------------------------------------
*/
*
* In parallel mode, turn control over to the parallel-restore logic.
*/
- if (ropt->number_of_threads > 1 && ropt->useDB)
+ if (ropt->number_of_jobs > 1 && ropt->useDB)
restore_toc_entries_parallel(AH);
else
{
restore_toc_entries_parallel(ArchiveHandle *AH)
{
RestoreOptions *ropt = AH->ropt;
- int n_slots = ropt->number_of_threads;
+ int n_slots = ropt->number_of_jobs;
ParallelSlot *slots;
int work_status;
int next_slot;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.95 2009/03/11 03:33:29 adunstan Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.96 2009/03/20 09:21:09 petere Exp $
*
*-------------------------------------------------------------------------
*/
{"host", 1, NULL, 'h'},
{"ignore-version", 0, NULL, 'i'},
{"index", 1, NULL, 'I'},
+ {"jobs", 1, NULL, 'j'},
{"list", 0, NULL, 'l'},
- {"multi-thread", 1, NULL, 'm'},
{"no-privileges", 0, NULL, 'x'},
{"no-acl", 0, NULL, 'x'},
{"no-owner", 0, NULL, 'O'},
}
}
- while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:lL:m:n:Op:P:RsS:t:T:U:vwWxX:1",
+ while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:j:lL:n:Op:P:RsS:t:T:U:vwWxX:1",
cmdopts, NULL)) != -1)
{
switch (c)
/* ignored, deprecated option */
break;
+ case 'j': /* number of restore jobs */
+ opts->number_of_jobs = atoi(optarg);
+ break;
+
case 'l': /* Dump the TOC summary */
opts->tocSummary = 1;
break;
opts->tocFile = strdup(optarg);
break;
- case 'm': /* number of restore threads */
- opts->number_of_threads = atoi(optarg);
- break;
-
case 'n': /* Dump data for this schema only */
opts->schemaNames = strdup(optarg);
break;
}
/* Can't do single-txn mode with multiple connections */
- if (opts->single_txn && opts->number_of_threads > 1)
+ if (opts->single_txn && opts->number_of_jobs > 1)
{
- fprintf(stderr, _("%s: cannot specify both --single-transaction and multiple threads\n"),
+ fprintf(stderr, _("%s: cannot specify both --single-transaction and multiple jobs\n"),
progname);
exit(1);
}
printf(_(" -C, --create create the target database\n"));
printf(_(" -e, --exit-on-error exit on error, default is to continue\n"));
printf(_(" -I, --index=NAME restore named index\n"));
+ printf(_(" -j, --jobs=NUM use this many parallel jobs to restore\n"));
printf(_(" -L, --use-list=FILENAME use table of contents from this file for\n"
" selecting/ordering output\n"));
- printf(_(" -m, --multi-thread=NUM use this many parallel connections to restore\n"));
printf(_(" -n, --schema=NAME restore only objects in this schema\n"));
printf(_(" -O, --no-owner skip restoration of object ownership\n"));
printf(_(" -P, --function=NAME(args)\n"