76 dstshstats->
stats = *srcstats;
95 char relkind = rel->
rd_rel->relkind;
100 if (!RELKIND_HAS_STORAGE(relkind) && relkind != RELKIND_PARTITIONED_TABLE)
140 rel->
rd_rel->relisshared);
198 if (pgstat_info->
trans &&
229 dboid, tableoid,
false);
232 tabentry = &shtabentry->
stats;
295 rel->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
301 livetuples -=
trans->tuples_inserted -
trans->tuples_deleted;
302 deadtuples -=
trans->tuples_updated +
trans->tuples_deleted;
307 livetuples =
Max(livetuples, 0);
308 deadtuples =
Max(deadtuples, 0);
319 tabentry = &shtabentry->
stats;
498 tabstat =
trans->parent;
510 if (
trans->truncdropped)
518 trans->tuples_inserted -
trans->tuples_deleted;
521 trans->tuples_updated +
trans->tuples_deleted;
524 trans->tuples_inserted +
trans->tuples_updated +
525 trans->tuples_deleted;
531 trans->tuples_inserted +
trans->tuples_updated;
534 tabstat->
trans = NULL;
555 next_trans =
trans->next;
557 tabstat =
trans->parent;
562 if (
trans->upper &&
trans->upper->nest_level == nestDepth - 1)
564 if (
trans->truncdropped)
569 trans->upper->tuples_inserted =
trans->tuples_inserted;
570 trans->upper->tuples_updated =
trans->tuples_updated;
571 trans->upper->tuples_deleted =
trans->tuples_deleted;
575 trans->upper->tuples_inserted +=
trans->tuples_inserted;
576 trans->upper->tuples_updated +=
trans->tuples_updated;
577 trans->upper->tuples_deleted +=
trans->tuples_deleted;
597 trans->nest_level = nestDepth - 1;
615 trans->tuples_inserted +
trans->tuples_updated;
638 tabstat =
trans->parent;
647 record.
t_id = tabstat->t_id;
648 record.
t_shared = tabstat->t_shared;
673 tabstat =
trans->parent;
674 tabstat->
trans = NULL;
770 if (memcmp(&lstats->
t_counts, &all_zeroes,
780 tabentry = &shtabstats->
stats;
857 pending->
t_id = rel_id;
882 trans->nest_level = nest_level;
884 trans->parent = pgstat_info;
898 if (pgstat_info->
trans == NULL ||
915 if (!
trans->truncdropped || is_drop)
917 trans->inserted_pre_truncdrop =
trans->tuples_inserted;
918 trans->updated_pre_truncdrop =
trans->tuples_updated;
919 trans->deleted_pre_truncdrop =
trans->tuples_deleted;
920 trans->truncdropped =
true;
930 if (
trans->truncdropped)
932 trans->tuples_inserted =
trans->inserted_pre_truncdrop;
933 trans->tuples_updated =
trans->updated_pre_truncdrop;
934 trans->tuples_deleted =
trans->deleted_pre_truncdrop;
bool IsAutoVacuumWorkerProcess(void)
TimestampTz GetCurrentTimestamp(void)
#define PG_USED_FOR_ASSERTS_ONLY
bool IsSharedRelation(Oid relationId)
if(TABLE==NULL||TABLE_index==NULL)
Assert(fmt[strlen(fmt) - 1] !='\n')
MemoryContext TopTransactionContext
void pfree(void *pointer)
void * MemoryContextAllocZero(MemoryContext context, Size size)
void * pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, Oid objoid)
PgStat_EntryRef * pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, Oid objoid, bool *created_entry)
PgStat_EntryRef * pgstat_fetch_pending_entry(PgStat_Kind kind, Oid dboid, Oid objoid)
#define pgstat_should_count_relation(rel)
PgStat_StatDBEntry * pgstat_prep_database_pending(Oid dboid)
struct TwoPhasePgStatRecord TwoPhasePgStatRecord
static void ensure_tabstat_xact_level(PgStat_TableStatus *pgstat_info)
void pgstat_copy_relation_stats(Relation dst, Relation src)
void pgstat_unlink_relation(Relation rel)
void pgstat_count_heap_update(Relation rel, bool hot)
void pgstat_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len)
static PgStat_TableStatus * pgstat_prep_relation_pending(Oid rel_id, bool isshared)
PgStat_TableStatus * find_tabstat_entry(Oid rel_id)
void pgstat_assoc_relation(Relation rel)
void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter)
static void save_truncdrop_counters(PgStat_TableXactStatus *trans, bool is_drop)
void AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len)
static void add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
bool pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry_ext(bool shared, Oid reloid)
void pgstat_create_relation(Relation rel)
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry(Oid relid)
void pgstat_update_heap_dead_tuples(Relation rel, int delta)
void pgstat_count_heap_delete(Relation rel)
void pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
void AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter livetuples, PgStat_Counter deadtuples)
void PostPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
void pgstat_count_truncate(Relation rel)
static void restore_truncdrop_counters(PgStat_TableXactStatus *trans)
void pgstat_drop_relation(Relation rel)
void AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, int nestDepth)
void pgstat_init_relation(Relation rel)
void pgstat_relation_delete_pending_cb(PgStat_EntryRef *entry_ref)
void pgstat_unlock_entry(PgStat_EntryRef *entry_ref)
bool pgstat_lock_entry(PgStat_EntryRef *entry_ref, bool nowait)
PgStat_EntryRef * pgstat_get_entry_ref_locked(PgStat_Kind kind, Oid dboid, Oid objoid, bool nowait)
void pgstat_create_transactional(PgStat_Kind kind, Oid dboid, Oid objoid)
void pgstat_drop_transactional(PgStat_Kind kind, Oid dboid, Oid objoid)
PgStat_SubXactStatus * pgstat_get_xact_stack_level(int nest_level)
#define RelationGetRelid(relation)
PgStat_StatTabEntry stats
PgStatShared_Common * shared_stats
PgStatShared_HashEntry * shared_entry
PgStat_Counter tuples_updated
PgStat_Counter tuples_inserted
PgStat_Counter tuples_returned
PgStat_Counter blocks_hit
PgStat_Counter blocks_fetched
PgStat_Counter tuples_deleted
PgStat_Counter tuples_fetched
PgStat_Counter vacuum_count
PgStat_Counter tuples_fetched
PgStat_Counter ins_since_vacuum
PgStat_Counter blocks_hit
PgStat_Counter mod_since_analyze
TimestampTz last_autovacuum_time
PgStat_Counter analyze_count
PgStat_Counter tuples_deleted
PgStat_Counter tuples_hot_updated
PgStat_Counter tuples_updated
PgStat_Counter live_tuples
PgStat_Counter autovacuum_count
TimestampTz last_analyze_time
PgStat_Counter dead_tuples
PgStat_Counter autoanalyze_count
PgStat_Counter blocks_fetched
PgStat_Counter tuples_returned
TimestampTz last_autoanalyze_time
PgStat_Counter tuples_inserted
TimestampTz last_vacuum_time
PgStat_TableXactStatus * first
PgStat_Counter t_delta_dead_tuples
PgStat_Counter t_delta_live_tuples
PgStat_Counter t_tuples_hot_updated
PgStat_Counter t_tuples_inserted
PgStat_Counter t_tuples_updated
PgStat_Counter t_tuples_fetched
PgStat_Counter t_tuples_deleted
PgStat_Counter t_numscans
PgStat_Counter t_blocks_hit
PgStat_Counter t_changed_tuples
PgStat_Counter t_blocks_fetched
PgStat_Counter t_tuples_returned
PgStat_TableCounts t_counts
struct PgStat_TableXactStatus * trans
PgStat_Counter tuples_inserted
PgStat_Counter tuples_updated
PgStat_Counter tuples_deleted
struct PgStat_TableStatus * pgstat_info
PgStat_Counter deleted_pre_truncdrop
PgStat_Counter inserted_pre_truncdrop
PgStat_Counter updated_pre_truncdrop
PgStat_Counter tuples_deleted
PgStat_Counter tuples_inserted
PgStat_Counter tuples_updated
void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info, const void *data, uint32 len)
#define TWOPHASE_RM_PGSTAT_ID
int GetCurrentTransactionNestLevel(void)
TimestampTz GetCurrentTransactionStopTimestamp(void)
static zic_t trans[TZ_MAX_LEAPS]