93 char relkind = rel->
rd_rel->relkind;
138 rel->
rd_rel->relisshared);
196 if (pgstat_info->
trans &&
251 tabentry->last_autovacuum_time = ts;
351 tabentry->last_autoanalyze_time = ts;
566 tabstat->counts.tuples_inserted +=
trans->tuples_inserted;
567 tabstat->counts.tuples_updated +=
trans->tuples_updated;
568 tabstat->counts.tuples_deleted +=
trans->tuples_deleted;
572 if (
trans->truncdropped)
575 tabstat->counts.delta_live_tuples = 0;
576 tabstat->counts.delta_dead_tuples = 0;
579 tabstat->counts.delta_live_tuples +=
580 trans->tuples_inserted -
trans->tuples_deleted;
582 tabstat->counts.delta_dead_tuples +=
583 trans->tuples_updated +
trans->tuples_deleted;
585 tabstat->counts.changed_tuples +=
586 trans->tuples_inserted +
trans->tuples_updated +
587 trans->tuples_deleted;
592 tabstat->counts.delta_dead_tuples +=
593 trans->tuples_inserted +
trans->tuples_updated;
626 if (
trans->truncdropped)
631 trans->upper->tuples_inserted =
trans->tuples_inserted;
632 trans->upper->tuples_updated =
trans->tuples_updated;
633 trans->upper->tuples_deleted =
trans->tuples_deleted;
637 trans->upper->tuples_inserted +=
trans->tuples_inserted;
638 trans->upper->tuples_updated +=
trans->tuples_updated;
639 trans->upper->tuples_deleted +=
trans->tuples_deleted;
672 tabstat->counts.tuples_inserted +=
trans->tuples_inserted;
673 tabstat->counts.tuples_updated +=
trans->tuples_updated;
674 tabstat->counts.tuples_deleted +=
trans->tuples_deleted;
676 tabstat->counts.delta_dead_tuples +=
677 trans->tuples_inserted +
trans->tuples_updated;
842 if (
lstats->counts.numscans)
854 tabentry->tuples_hot_updated +=
lstats->counts.tuples_hot_updated;
855 tabentry->tuples_newpage_updated +=
lstats->counts.tuples_newpage_updated;
860 if (
lstats->counts.truncdropped)
932 pending->
id = rel_id;
933 pending->
shared = isshared;
957 trans->nest_level = nest_level;
992 trans->inserted_pre_truncdrop =
trans->tuples_inserted;
993 trans->updated_pre_truncdrop =
trans->tuples_updated;
994 trans->deleted_pre_truncdrop =
trans->tuples_deleted;
995 trans->truncdropped =
true;
1005 if (
trans->truncdropped)
1007 trans->tuples_inserted =
trans->inserted_pre_truncdrop;
1008 trans->tuples_updated =
trans->updated_pre_truncdrop;
1009 trans->tuples_deleted =
trans->deleted_pre_truncdrop;
long TimestampDifferenceMilliseconds(TimestampTz start_time, TimestampTz stop_time)
TimestampTz GetCurrentTimestamp(void)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
bool IsSharedRelation(Oid relationId)
#define palloc_object(type)
void * MemoryContextAllocZero(MemoryContext context, Size size)
MemoryContext TopTransactionContext
void pfree(void *pointer)
static bool pg_memory_is_all_zeros(const void *ptr, size_t len)
#define AmAutoVacuumWorkerProcess()
PgStat_EntryRef * pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, uint64 objid, bool *created_entry)
PgStat_EntryRef * pgstat_fetch_pending_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
void * pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
#define pgstat_should_count_relation(rel)
bool pgstat_flush_backend(bool nowait, bits32 flags)
PgStat_StatDBEntry * pgstat_prep_database_pending(Oid dboid)
#define PGSTAT_BACKEND_FLUSH_IO
void pgstat_flush_io(bool nowait)
#define PGSTAT_KIND_RELATION
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, bool newpage)
void pgstat_report_vacuum(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, TimestampTz starttime)
void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter, TimestampTz starttime)
static PgStat_TableStatus * pgstat_prep_relation_pending(Oid rel_id, bool isshared)
void pgstat_assoc_relation(Relation rel)
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry_ext(bool shared, Oid reloid)
static void save_truncdrop_counters(PgStat_TableXactStatus *trans, bool is_drop)
void AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry(Oid relid)
static void add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
bool pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
void pgstat_create_relation(Relation rel)
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)
PgStat_TableStatus * find_tabstat_entry(Oid rel_id)
void AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
void pgstat_relation_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts)
void PostPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
void pgstat_twophase_postcommit(FullTransactionId fxid, uint16 info, void *recdata, uint32 len)
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_twophase_postabort(FullTransactionId fxid, uint16 info, void *recdata, uint32 len)
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, uint64 objid, bool nowait)
void pgstat_drop_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
void pgstat_create_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
PgStat_SubXactStatus * pgstat_get_xact_stack_level(int nest_level)
#define RelationGetRelid(relation)
PgStatShared_Common * shared_stats
PgStatShared_HashEntry * shared_entry
PgStat_TableXactStatus * first
PgStat_Counter tuples_hot_updated
PgStat_Counter tuples_inserted
PgStat_Counter delta_live_tuples
PgStat_Counter changed_tuples
PgStat_Counter tuples_updated
PgStat_Counter tuples_newpage_updated
PgStat_Counter delta_dead_tuples
PgStat_Counter tuples_deleted
PgStat_TableCounts counts
struct PgStat_TableXactStatus * trans
PgStat_TableStatus * parent
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]