@@ -85,7 +85,8 @@ static MemoryContext anl_context = NULL;
85
85
static BufferAccessStrategy vac_strategy ;
86
86
87
87
88
- static void do_analyze_rel (Relation onerel , int options , List * va_cols ,
88
+ static void do_analyze_rel (Relation onerel , int options ,
89
+ VacuumParams * params , List * va_cols ,
89
90
AcquireSampleRowsFunc acquirefunc , BlockNumber relpages ,
90
91
bool inh , bool in_outer_xact , int elevel );
91
92
static void BlockSampler_Init (BlockSampler bs , BlockNumber nblocks ,
@@ -115,8 +116,9 @@ static Datum ind_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
115
116
* analyze_rel() -- analyze one relation
116
117
*/
117
118
void
118
- analyze_rel (Oid relid , RangeVar * relation , int options , List * va_cols ,
119
- bool in_outer_xact , BufferAccessStrategy bstrategy )
119
+ analyze_rel (Oid relid , RangeVar * relation , int options ,
120
+ VacuumParams * params , List * va_cols , bool in_outer_xact ,
121
+ BufferAccessStrategy bstrategy )
120
122
{
121
123
Relation onerel ;
122
124
int elevel ;
@@ -151,7 +153,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options, List *va_cols,
151
153
else
152
154
{
153
155
onerel = NULL ;
154
- if (IsAutoVacuumWorkerProcess () && Log_autovacuum_min_duration >= 0 )
156
+ if (IsAutoVacuumWorkerProcess () && params -> log_min_duration >= 0 )
155
157
ereport (LOG ,
156
158
(errcode (ERRCODE_LOCK_NOT_AVAILABLE ),
157
159
errmsg ("skipping analyze of \"%s\" --- lock not available" ,
@@ -266,14 +268,14 @@ analyze_rel(Oid relid, RangeVar *relation, int options, List *va_cols,
266
268
/*
267
269
* Do the normal non-recursive ANALYZE.
268
270
*/
269
- do_analyze_rel (onerel , options , va_cols , acquirefunc , relpages ,
271
+ do_analyze_rel (onerel , options , params , va_cols , acquirefunc , relpages ,
270
272
false, in_outer_xact , elevel );
271
273
272
274
/*
273
275
* If there are child tables, do recursive ANALYZE.
274
276
*/
275
277
if (onerel -> rd_rel -> relhassubclass )
276
- do_analyze_rel (onerel , options , va_cols , acquirefunc , relpages ,
278
+ do_analyze_rel (onerel , options , params , va_cols , acquirefunc , relpages ,
277
279
true, in_outer_xact , elevel );
278
280
279
281
/*
@@ -301,9 +303,10 @@ analyze_rel(Oid relid, RangeVar *relation, int options, List *va_cols,
301
303
* appropriate acquirefunc for each child table.
302
304
*/
303
305
static void
304
- do_analyze_rel (Relation onerel , int options , List * va_cols ,
305
- AcquireSampleRowsFunc acquirefunc , BlockNumber relpages ,
306
- bool inh , bool in_outer_xact , int elevel )
306
+ do_analyze_rel (Relation onerel , int options , VacuumParams * params ,
307
+ List * va_cols , AcquireSampleRowsFunc acquirefunc ,
308
+ BlockNumber relpages , bool inh , bool in_outer_xact ,
309
+ int elevel )
307
310
{
308
311
int attr_cnt ,
309
312
tcnt ,
@@ -359,10 +362,10 @@ do_analyze_rel(Relation onerel, int options, List *va_cols,
359
362
save_nestlevel = NewGUCNestLevel ();
360
363
361
364
/* measure elapsed time iff autovacuum logging requires it */
362
- if (IsAutoVacuumWorkerProcess () && Log_autovacuum_min_duration >= 0 )
365
+ if (IsAutoVacuumWorkerProcess () && params -> log_min_duration >= 0 )
363
366
{
364
367
pg_rusage_init (& ru0 );
365
- if (Log_autovacuum_min_duration > 0 )
368
+ if (params -> log_min_duration > 0 )
366
369
starttime = GetCurrentTimestamp ();
367
370
}
368
371
@@ -647,11 +650,11 @@ do_analyze_rel(Relation onerel, int options, List *va_cols,
647
650
vac_close_indexes (nindexes , Irel , NoLock );
648
651
649
652
/* Log the action if appropriate */
650
- if (IsAutoVacuumWorkerProcess () && Log_autovacuum_min_duration >= 0 )
653
+ if (IsAutoVacuumWorkerProcess () && params -> log_min_duration >= 0 )
651
654
{
652
- if (Log_autovacuum_min_duration == 0 ||
655
+ if (params -> log_min_duration == 0 ||
653
656
TimestampDifferenceExceeds (starttime , GetCurrentTimestamp (),
654
- Log_autovacuum_min_duration ))
657
+ params -> log_min_duration ))
655
658
ereport (LOG ,
656
659
(errmsg ("automatic analyze of table \"%s.%s.%s\" system usage: %s" ,
657
660
get_database_name (MyDatabaseId ),
0 commit comments