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

Commita6fea12

Browse files
author
Amit Kapila
committed
Comments and doc fixes for commit40d964e.
Reported-by: Justin PryzbyAuthor: Justin Pryzby, with few changes by meReviewed-by: Amit Kapila and Sawada MasahikoDiscussion:https://postgr.es/m/20200322021801.GB2563@telsasoft.com
1 parent826ee1a commita6fea12

File tree

5 files changed

+49
-49
lines changed

5 files changed

+49
-49
lines changed

‎doc/src/sgml/ref/vacuum.sgml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,23 +232,23 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
232232
<term><literal>PARALLEL</literal></term>
233233
<listitem>
234234
<para>
235-
Performvacuumindex andcleanupindex phases of <command>VACUUM</command>
235+
Perform indexvacuumand index cleanup phases of <command>VACUUM</command>
236236
in parallel using <replaceable class="parameter">integer</replaceable>
237-
background workers (for thedetail of each vacuumphases, please
237+
background workers (for thedetails of each vacuumphase, please
238238
refer to <xref linkend="vacuum-phases"/>). If the
239-
<literal>PARALLEL</literal> option is omitted, then
240-
<command>VACUUM</command> decidesthe number ofworkers based on number
241-
of indexes that support parallel vacuum operation on the relation which
242-
is further limited by <xreflinkend="guc-max-parallel-workers-maintenance"/>.
243-
The index can participate in a parallel vacuum if and only if the size
239+
<literal>PARALLEL</literal> option is omitted, then the number of workers
240+
is determined based onthe number ofindexes that support parallel vacuum
241+
operation on the relation, and is further limited by <xref
242+
linkend="guc-max-parallel-workers-maintenance"/>.
243+
An index can participate in parallel vacuum if and only if the size
244244
of the index is more than <xref linkend="guc-min-parallel-index-scan-size"/>.
245245
Please note that it is not guaranteed that the number of parallel workers
246246
specified in <replaceable class="parameter">integer</replaceable> will
247247
be used during execution. It is possible for a vacuum to run with fewer
248248
workers than specified, or even with no workers at all. Only one worker
249249
can be used per index. So parallel workers are launched only when there
250250
are at least <literal>2</literal> indexes in the table. Workers for
251-
vacuumlaunchesbeforestarting each phase and exit at the end of
251+
vacuumare launchedbeforethe start of each phase and exit at the end of
252252
the phase. These behaviors might change in a future release. This
253253
option can't be used with the <literal>FULL</literal> option.
254254
</para>
@@ -358,16 +358,16 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
358358
</para>
359359

360360
<para>
361-
The <option>PARALLEL</option> option is used only for vacuumpurpose.
362-
Even ifthis option is specified with <option>ANALYZE</option> option
361+
The <option>PARALLEL</option> option is used only for vacuumpurposes.
362+
Ifthis option is specified withthe<option>ANALYZE</option> option,
363363
it does not affect <option>ANALYZE</option>.
364364
</para>
365365

366366
<para>
367367
<command>VACUUM</command> causes a substantial increase in I/O traffic,
368368
which might cause poor performance for other active sessions. Therefore,
369369
it is sometimes advisable to use the cost-based vacuum delay feature. For
370-
parallel vacuum, each worker sleepsproportional to the work done by that
370+
parallel vacuum, each worker sleepsin proportion to the work done by that
371371
worker. See <xref linkend="runtime-config-resource-vacuum-cost"/> for
372372
details.
373373
</para>

‎src/backend/access/heap/vacuumlazy.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ typedef struct LVShared
208208
* live tuples in the index vacuum case or the new live tuples in the
209209
* index cleanup case.
210210
*
211-
* estimated_count is true ifthereltuples is an estimated value.
211+
* estimated_count is true if reltuples is an estimated value.
212212
*/
213213
doublereltuples;
214214
boolestimated_count;
@@ -232,8 +232,8 @@ typedef struct LVShared
232232

233233
/*
234234
* Number of active parallel workers. This is used for computing the
235-
* minimum threshold of the vacuum cost balancefor a workerto gofor the
236-
* delay.
235+
* minimum threshold of the vacuum cost balancebefore a workersleepsfor
236+
*cost-baseddelay.
237237
*/
238238
pg_atomic_uint32active_nworkers;
239239

@@ -732,7 +732,7 @@ vacuum_log_cleanup_info(Relation rel, LVRelStats *vacrelstats)
732732
*to reclaim dead line pointers.
733733
*
734734
*If the table has at least two indexes, we execute both index vacuum
735-
*and index cleanup with parallel workers unlesstheparallel vacuum is
735+
*and index cleanup with parallel workers unless parallel vacuum is
736736
*disabled. In a parallel vacuum, we enter parallel mode and then
737737
*create both the parallel context and the DSM segment before starting
738738
*heap scan so that we can record dead tuples to the DSM segment. All
@@ -809,8 +809,8 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
809809
vacrelstats->latestRemovedXid=InvalidTransactionId;
810810

811811
/*
812-
* Initializethestate for a parallel vacuum. As of now, only one worker
813-
*canbe used for an index, so we invoke parallelism only if there are at
812+
* Initialize state for a parallel vacuum. As of now, only one worker can
813+
* be used for an index, so we invoke parallelism only if there are at
814814
* least two indexes on a table.
815815
*/
816816
if (params->nworkers >=0&&vacrelstats->useindex&&nindexes>1)
@@ -837,7 +837,7 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
837837
}
838838

839839
/*
840-
* Allocate the space for dead tuples in casetheparallel vacuum is not
840+
* Allocate the space for dead tuples in case parallel vacuum is not
841841
* initialized.
842842
*/
843843
if (!ParallelVacuumIsActive(lps))
@@ -2215,7 +2215,7 @@ parallel_vacuum_index(Relation *Irel, IndexBulkDeleteResult **stats,
22152215
shared_indstats=get_indstats(lvshared,idx);
22162216

22172217
/*
2218-
* Skip processing indexes thatdoesn't participate in parallel
2218+
* Skip processing indexes thatdon't participate in parallel
22192219
* operation
22202220
*/
22212221
if (shared_indstats==NULL||
@@ -2312,12 +2312,12 @@ vacuum_one_index(Relation indrel, IndexBulkDeleteResult **stats,
23122312

23132313
/*
23142314
* Copy the index bulk-deletion result returned from ambulkdelete and
2315-
* amvacuumcleanup to the DSM segment if it's the firsttime to get it
2316-
*from them, because theyallocateitlocally and it's possible that an
2317-
*index will be vacuumed bythedifferent vacuum process at thenext
2318-
*time. The copying of the result normally happens only after the first
2319-
*time of index vacuuming. From thesecond time, we passtheresult on
2320-
*the DSM segmentso thatthey then update it directly.
2315+
* amvacuumcleanup to the DSM segment if it's the firstcycle because they
2316+
* allocate locally and it's possible that an index will be vacuumed by a
2317+
*different vacuum processthenext cycle. Copying theresult normally
2318+
*happens only the first time an index is vacuumed. For any additional
2319+
*vacuum pass, we directly point to theresult ontheDSM segment and
2320+
*pass it to vacuum index APIsso thatworkers can update it directly.
23212321
*
23222322
* Since all vacuum workers write the bulk-deletion result at different
23232323
* slots we can write them without locking.
@@ -2328,8 +2328,8 @@ vacuum_one_index(Relation indrel, IndexBulkDeleteResult **stats,
23282328
shared_indstats->updated= true;
23292329

23302330
/*
2331-
* Now thatthestats[idx] points to the DSM segment, we don't need
2332-
*thelocally allocated results.
2331+
* Now that stats[idx] points to the DSM segment, we don't need the
2332+
* locally allocated results.
23332333
*/
23342334
pfree(*stats);
23352335
*stats=bulkdelete_res;
@@ -2449,7 +2449,7 @@ lazy_vacuum_index(Relation indrel, IndexBulkDeleteResult **stats,
24492449
*lazy_cleanup_index() -- do post-vacuum cleanup for one index relation.
24502450
*
24512451
*reltuples is the number of heap tuples and estimated_count is true
2452-
*ifthereltuples is an estimated value.
2452+
*if reltuples is an estimated value.
24532453
*/
24542454
staticvoid
24552455
lazy_cleanup_index(Relationindrel,
@@ -3050,9 +3050,9 @@ heap_page_is_all_visible(Relation rel, Buffer buf,
30503050
/*
30513051
* Compute the number of parallel worker processes to request. Both index
30523052
* vacuum and index cleanup can be executed with parallel workers. The index
3053-
* is eligible for parallel vacuum iffit's size is greater than
3053+
* is eligible for parallel vacuum iffits size is greater than
30543054
* min_parallel_index_scan_size as invoking workers for very small indexes
3055-
* can hurttheperformance.
3055+
* can hurt performance.
30563056
*
30573057
* nrequested is the number of parallel workers that user requested. If
30583058
* nrequested is 0, we compute the parallel degree based on nindexes, that is
@@ -3071,7 +3071,7 @@ compute_parallel_vacuum_workers(Relation *Irel, int nindexes, int nrequested,
30713071
inti;
30723072

30733073
/*
3074-
* We don't allowto perform parallel operation in standalone backend or
3074+
* We don't allowperforming parallel operation in standalone backend or
30753075
* when parallelism is disabled.
30763076
*/
30773077
if (!IsUnderPostmaster||max_parallel_maintenance_workers==0)
@@ -3138,13 +3138,13 @@ prepare_index_statistics(LVShared *lvshared, bool *can_parallel_vacuum,
31383138
if (!can_parallel_vacuum[i])
31393139
continue;
31403140

3141-
/* Set NOT NULL as this indexdo support parallelism */
3141+
/* Set NOT NULL as this indexdoes support parallelism */
31423142
lvshared->bitmap[i >>3] |=1 << (i&0x07);
31433143
}
31443144
}
31453145

31463146
/*
3147-
* Update index statistics in pg_class if the statisticsis accurate.
3147+
* Update index statistics in pg_class if the statisticsare accurate.
31483148
*/
31493149
staticvoid
31503150
update_index_statistics(Relation*Irel,IndexBulkDeleteResult**stats,
@@ -3174,7 +3174,7 @@ update_index_statistics(Relation *Irel, IndexBulkDeleteResult **stats,
31743174

31753175
/*
31763176
* This function prepares and returns parallel vacuum state if we can launch
3177-
* even one worker. This function is responsibleto enter parallel mode,
3177+
* even one worker. This function is responsiblefor entering parallel mode,
31783178
* create a parallel context, and then initialize the DSM segment.
31793179
*/
31803180
staticLVParallelState*
@@ -3345,8 +3345,8 @@ begin_parallel_vacuum(Oid relid, Relation *Irel, LVRelStats *vacrelstats,
33453345
/*
33463346
* Destroy the parallel context, and end parallel mode.
33473347
*
3348-
* Since writes are not allowed duringtheparallel mode, so we copy the
3349-
* updated index statistics from DSMin local memory and then later use that
3348+
* Since writes are not allowed during parallel mode, copy the
3349+
* updated index statistics from DSMinto local memory and then later use that
33503350
* to update the index statistics. One might think that we can exit from
33513351
* parallel mode, update the index statistics and then destroy parallel
33523352
* context, but that won't be safe (see ExitParallelMode).
@@ -3452,7 +3452,7 @@ skip_parallel_vacuum_index(Relation indrel, LVShared *lvshared)
34523452
* Perform work within a launched parallel process.
34533453
*
34543454
* Since parallel vacuum workers perform only index vacuum or index cleanup,
3455-
* we don't need to reporttheprogress information.
3455+
* we don't need to report progress information.
34563456
*/
34573457
void
34583458
parallel_vacuum_main(dsm_segment*seg,shm_toc*toc)

‎src/backend/access/transam/parallel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ ReinitializeParallelDSM(ParallelContext *pcxt)
505505

506506
/*
507507
* Reinitialize parallel workers for a parallel context such that we could
508-
* launchthe different number of workers. This is required for cases where
508+
* launcha different number of workers. This is required for cases where
509509
* we need to reuse the same DSM segment, but the number of workers can
510510
* vary from run-to-run.
511511
*/

‎src/backend/commands/vacuum.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,23 +2036,23 @@ vacuum_delay_point(void)
20362036
/*
20372037
* Computes the vacuum delay for parallel workers.
20382038
*
2039-
* The basic idea of a cost-basedvacuumdelay for parallel vacuum is to allow
2040-
*eachworker to sleepproportionalto thework done by it. We achieve this
2039+
* The basic idea of a cost-based delay for parallel vacuum is to allow each
2040+
* worker to sleepin proportionto theshare of work it's done. We achieve this
20412041
* by allowing all parallel vacuum workers including the leader process to
20422042
* have a shared view of cost related parameters (mainly VacuumCostBalance).
20432043
* We allow each worker to update it as and when it has incurred any cost and
20442044
* then based on that decide whether it needs to sleep. We compute the time
20452045
* to sleep for a worker based on the cost it has incurred
20462046
* (VacuumCostBalanceLocal) and then reduce the VacuumSharedCostBalance by
2047-
* that amount. This avoidsletting the workerssleepwhohave done less or
2048-
*noI/Oas compared toother workers and therefore can ensure that workers
2049-
*who are doing more I/O got throttled more.
2047+
* that amount. This avoidsputting tosleepthose workers whichhave done less
2048+
* I/Othanother workers and therefore ensure that workers
2049+
*which are doing more I/O got throttled more.
20502050
*
2051-
* We allowany worker to sleep only if it has performedtheI/O above a
2052-
*certainthreshold, which is calculated based on the number of active
2053-
*workers(VacuumActiveNWorkers), and the overall cost balance is more than
2054-
* VacuumCostLimit set by the system.The testing reveals that we achieve
2055-
* the required throttling if weallow a worker that has done more than 50%
2051+
* We allowa worker to sleep only if it has performed I/O above a certain
2052+
* threshold, which is calculated based on the number of active workers
2053+
* (VacuumActiveNWorkers), and the overall cost balance is more than
2054+
* VacuumCostLimit set by the system.Testing reveals that we achieve
2055+
* the required throttling if weforce a worker that has done more than 50%
20562056
* of its share of work to sleep.
20572057
*/
20582058
staticdouble

‎src/include/commands/vacuum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ typedef struct VacuumParams
225225

226226
/*
227227
* The number of parallel vacuum workers. 0 by default which means choose
228-
* based on the number of indexes. -1 indicatesaparallel vacuum is
228+
* based on the number of indexes. -1 indicates parallel vacuum is
229229
* disabled.
230230
*/
231231
intnworkers;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp