I noticed that analyze messages shown by autovacuum don't discriminate
between non-inherited cases and inherited cases, as shown in the below
example:

LOG:  automatic analyze of table "postgres.public.pt" system usage: CPU
0.00s/0.01u sec elapsed 0.06 sec
LOG:  automatic analyze of table "postgres.public.pt" system usage: CPU
0.00s/0.02u sec elapsed 0.11 sec

(The first one is for table "postgres.public.pt" and the second one is
for table inheritance tree "postgres.public.pt".)

So, I'd like to propose improving the messages for inherited cases, in
order to easily distinguish such cases from non-inherited cases.  Please
find attached a patch.  I'll add this to the upcoming CF.

Thanks,

Best regards,
Etsuro Fujita
*** a/src/backend/commands/analyze.c
--- b/src/backend/commands/analyze.c
***************
*** 648,659 **** do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
  		if (Log_autovacuum_min_duration == 0 ||
  			TimestampDifferenceExceeds(starttime, GetCurrentTimestamp(),
  									   Log_autovacuum_min_duration))
! 			ereport(LOG,
! 					(errmsg("automatic analyze of table \"%s.%s.%s\" system usage: %s",
! 							get_database_name(MyDatabaseId),
! 							get_namespace_name(RelationGetNamespace(onerel)),
! 							RelationGetRelationName(onerel),
! 							pg_rusage_show(&ru0))));
  	}
  
  	/* Roll back any GUC changes executed by index functions */
--- 648,669 ----
  		if (Log_autovacuum_min_duration == 0 ||
  			TimestampDifferenceExceeds(starttime, GetCurrentTimestamp(),
  									   Log_autovacuum_min_duration))
! 		{
! 			if (inh)
! 				ereport(LOG,
! 						(errmsg("automatic analyze of table inheritance tree \"%s.%s.%s\" system usage: %s",
! 								get_database_name(MyDatabaseId),
! 								get_namespace_name(RelationGetNamespace(onerel)),
! 								RelationGetRelationName(onerel),
! 								pg_rusage_show(&ru0))));
! 			else
! 				ereport(LOG,
! 						(errmsg("automatic analyze of table \"%s.%s.%s\" system usage: %s",
! 								get_database_name(MyDatabaseId),
! 								get_namespace_name(RelationGetNamespace(onerel)),
! 								RelationGetRelationName(onerel),
! 								pg_rusage_show(&ru0))));
! 		}
  	}
  
  	/* Roll back any GUC changes executed by index functions */
-- 
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