74 dstshstats->
stats = *srcstats;
93 char relkind = rel->
rd_rel->relkind;
98 if (!RELKIND_HAS_STORAGE(relkind) && relkind != RELKIND_PARTITIONED_TABLE)
138 rel->
rd_rel->relisshared);
196 if (pgstat_info->
trans &&
232 tabentry = &shtabentry->
stats;
308 rel->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
314 livetuples -=
trans->tuples_inserted -
trans->tuples_deleted;
315 deadtuples -=
trans->tuples_updated +
trans->tuples_deleted;
320 livetuples =
Max(livetuples, 0);
321 deadtuples =
Max(deadtuples, 0);
336 tabentry = &shtabentry->
stats;
390 Assert(!(hot && newpage));
517 *tablestatus = *tabentry;
524 tablestatus->
trans = NULL;
560 tabstat =
trans->parent;
572 if (
trans->truncdropped)
580 trans->tuples_inserted -
trans->tuples_deleted;
583 trans->tuples_updated +
trans->tuples_deleted;
586 trans->tuples_inserted +
trans->tuples_updated +
587 trans->tuples_deleted;
593 trans->tuples_inserted +
trans->tuples_updated;
596 tabstat->
trans = NULL;
617 next_trans =
trans->next;
619 tabstat =
trans->parent;
624 if (
trans->upper &&
trans->upper->nest_level == nestDepth - 1)
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;
659 trans->nest_level = nestDepth - 1;
677 trans->tuples_inserted +
trans->tuples_updated;
700 tabstat =
trans->parent;
709 record.
id = tabstat->id;
710 record.
shared = tabstat->shared;
735 tabstat =
trans->parent;
736 tabstat->
trans = NULL;
839 tabentry = &shtabstats->
stats;
932 pending->
id = rel_id;
933 pending->
shared = isshared;
957 trans->nest_level = nest_level;
959 trans->parent = pgstat_info;
973 if (pgstat_info->
trans == NULL ||
990 if (!
trans->truncdropped || is_drop)
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
bool IsSharedRelation(Oid relationId)
#define palloc_object(type)
Assert(PointerIsAligned(start, uint64))
if(TABLE==NULL||TABLE_index==NULL)
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
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, 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)
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
PgStat_Counter total_autovacuum_time
PgStat_Counter total_analyze_time
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 total_autoanalyze_time
PgStat_Counter tuples_inserted
PgStat_Counter total_vacuum_time
PgStat_Counter tuples_newpage_updated
TimestampTz last_vacuum_time
PgStat_TableXactStatus * first
PgStat_Counter blocks_hit
PgStat_Counter tuples_hot_updated
PgStat_Counter tuples_returned
PgStat_Counter tuples_inserted
PgStat_Counter delta_live_tuples
PgStat_Counter changed_tuples
PgStat_Counter tuples_updated
PgStat_Counter blocks_fetched
PgStat_Counter tuples_fetched
PgStat_Counter tuples_newpage_updated
PgStat_Counter delta_dead_tuples
PgStat_Counter tuples_deleted
PgStat_TableCounts 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]