@ -1266,11 +1266,15 @@ pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter tuples)
* pgstat_report_analyze ( ) -
* pgstat_report_analyze ( ) -
*
*
* Tell the collector about the table we just analyzed .
* Tell the collector about the table we just analyzed .
*
* Caller must provide new live - and dead - tuples estimates , as well as a
* flag indicating whether to reset the changes_since_analyze counter .
* - - - - - - - -
* - - - - - - - -
*/
*/
void
void
pgstat_report_analyze ( Relation rel ,
pgstat_report_analyze ( Relation rel ,
PgStat_Counter livetuples , PgStat_Counter deadtuples )
PgStat_Counter livetuples , PgStat_Counter deadtuples ,
bool resetcounter )
{
{
PgStat_MsgAnalyze msg ;
PgStat_MsgAnalyze msg ;
@ -1307,6 +1311,7 @@ pgstat_report_analyze(Relation rel,
msg . m_databaseid = rel - > rd_rel - > relisshared ? InvalidOid : MyDatabaseId ;
msg . m_databaseid = rel - > rd_rel - > relisshared ? InvalidOid : MyDatabaseId ;
msg . m_tableoid = RelationGetRelid ( rel ) ;
msg . m_tableoid = RelationGetRelid ( rel ) ;
msg . m_autovacuum = IsAutoVacuumWorkerProcess ( ) ;
msg . m_autovacuum = IsAutoVacuumWorkerProcess ( ) ;
msg . m_resetcounter = resetcounter ;
msg . m_analyzetime = GetCurrentTimestamp ( ) ;
msg . m_analyzetime = GetCurrentTimestamp ( ) ;
msg . m_live_tuples = livetuples ;
msg . m_live_tuples = livetuples ;
msg . m_dead_tuples = deadtuples ;
msg . m_dead_tuples = deadtuples ;
@ -4236,9 +4241,11 @@ pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len)
tabentry - > n_dead_tuples = msg - > m_dead_tuples ;
tabentry - > n_dead_tuples = msg - > m_dead_tuples ;
/*
/*
* We reset changes_since_analyze to zero , forgetting any changes that
* If commanded , reset changes_since_analyze to zero . This forgets any
* occurred while the ANALYZE was in progress .
* changes that were committed while the ANALYZE was in progress , but we
* have no good way to estimate how many of those there were .
*/
*/
if ( msg - > m_resetcounter )
tabentry - > changes_since_analyze = 0 ;
tabentry - > changes_since_analyze = 0 ;
if ( msg - > m_autovacuum )
if ( msg - > m_autovacuum )