@@ -85,7 +85,8 @@ static MemoryContext anl_context = NULL;
8585static BufferAccessStrategy vac_strategy ;
8686
8787
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 ,
8990AcquireSampleRowsFunc acquirefunc ,BlockNumber relpages ,
9091bool inh ,bool in_outer_xact ,int elevel );
9192static void BlockSampler_Init (BlockSampler bs ,BlockNumber nblocks ,
@@ -115,8 +116,9 @@ static Datum ind_fetch_func(VacAttrStatsP stats, int rownum, bool *isNull);
115116 *analyze_rel() -- analyze one relation
116117 */
117118void
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 )
120122{
121123Relation onerel ;
122124int elevel ;
@@ -151,7 +153,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options, List *va_cols,
151153else
152154{
153155onerel = NULL ;
154- if (IsAutoVacuumWorkerProcess ()&& Log_autovacuum_min_duration >=0 )
156+ if (IsAutoVacuumWorkerProcess ()&& params -> log_min_duration >=0 )
155157ereport (LOG ,
156158(errcode (ERRCODE_LOCK_NOT_AVAILABLE ),
157159errmsg ("skipping analyze of \"%s\" --- lock not available" ,
@@ -266,14 +268,14 @@ analyze_rel(Oid relid, RangeVar *relation, int options, List *va_cols,
266268/*
267269 * Do the normal non-recursive ANALYZE.
268270 */
269- do_analyze_rel (onerel ,options ,va_cols ,acquirefunc ,relpages ,
271+ do_analyze_rel (onerel ,options ,params , va_cols ,acquirefunc ,relpages ,
270272 false,in_outer_xact ,elevel );
271273
272274/*
273275 * If there are child tables, do recursive ANALYZE.
274276 */
275277if (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 ,
277279 true,in_outer_xact ,elevel );
278280
279281/*
@@ -301,9 +303,10 @@ analyze_rel(Oid relid, RangeVar *relation, int options, List *va_cols,
301303 * appropriate acquirefunc for each child table.
302304 */
303305static 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 )
307310{
308311int attr_cnt ,
309312tcnt ,
@@ -359,10 +362,10 @@ do_analyze_rel(Relation onerel, int options, List *va_cols,
359362save_nestlevel = NewGUCNestLevel ();
360363
361364/* measure elapsed time iff autovacuum logging requires it */
362- if (IsAutoVacuumWorkerProcess ()&& Log_autovacuum_min_duration >=0 )
365+ if (IsAutoVacuumWorkerProcess ()&& params -> log_min_duration >=0 )
363366{
364367pg_rusage_init (& ru0 );
365- if (Log_autovacuum_min_duration > 0 )
368+ if (params -> log_min_duration > 0 )
366369starttime = GetCurrentTimestamp ();
367370}
368371
@@ -647,11 +650,11 @@ do_analyze_rel(Relation onerel, int options, List *va_cols,
647650vac_close_indexes (nindexes ,Irel ,NoLock );
648651
649652/* Log the action if appropriate */
650- if (IsAutoVacuumWorkerProcess ()&& Log_autovacuum_min_duration >=0 )
653+ if (IsAutoVacuumWorkerProcess ()&& params -> log_min_duration >=0 )
651654{
652- if (Log_autovacuum_min_duration == 0 ||
655+ if (params -> log_min_duration == 0 ||
653656TimestampDifferenceExceeds (starttime ,GetCurrentTimestamp (),
654- Log_autovacuum_min_duration ))
657+ params -> log_min_duration ))
655658ereport (LOG ,
656659(errmsg ("automatic analyze of table \"%s.%s.%s\" system usage: %s" ,
657660get_database_name (MyDatabaseId ),