Hi,

While looking at Greg's patch I spotted that resource usage code for vacuum is initialized even if we won't use it. Attached is a small patch that moves it to the right place (this code mimics do_analyze_rel function).


--
  Euler Taveira de Oliveira - Timbira       http://www.timbira.com.br/
  PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index c5bf32e..b5547c5 100644
*** a/src/backend/commands/vacuumlazy.c
--- b/src/backend/commands/vacuumlazy.c
*************** lazy_vacuum_rel(Relation onerel, VacuumS
*** 155,165 ****
  	bool		scan_all;
  	TransactionId freezeTableLimit;
  
- 	pg_rusage_init(&ru0);
- 
  	/* measure elapsed time iff autovacuum logging requires it */
! 	if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration > 0)
! 		starttime = GetCurrentTimestamp();
  
  	if (vacstmt->options & VACOPT_VERBOSE)
  		elevel = INFO;
--- 155,167 ----
  	bool		scan_all;
  	TransactionId freezeTableLimit;
  
  	/* measure elapsed time iff autovacuum logging requires it */
! 	if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
! 	{
! 		pg_rusage_init(&ru0);
! 		if (Log_autovacuum_min_duration > 0)
! 			starttime = GetCurrentTimestamp();
! 	}
  
  	if (vacstmt->options & VACOPT_VERBOSE)
  		elevel = INFO;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to