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 &&
227 dboid, tableoid,
false);
230 tabentry = &shtabentry->
stats;
302 rel->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
308 livetuples -=
trans->tuples_inserted -
trans->tuples_deleted;
309 deadtuples -=
trans->tuples_updated +
trans->tuples_deleted;
314 livetuples =
Max(livetuples, 0);
315 deadtuples =
Max(deadtuples, 0);
326 tabentry = &shtabentry->
stats;
378 Assert(!(hot && newpage));
505 *tablestatus = *tabentry;
512 tablestatus->
trans = NULL;
548 tabstat =
trans->parent;
560 if (
trans->truncdropped)
568 trans->tuples_inserted -
trans->tuples_deleted;
571 trans->tuples_updated +
trans->tuples_deleted;
574 trans->tuples_inserted +
trans->tuples_updated +
575 trans->tuples_deleted;
581 trans->tuples_inserted +
trans->tuples_updated;
584 tabstat->
trans = NULL;
605 next_trans =
trans->next;
607 tabstat =
trans->parent;
612 if (
trans->upper &&
trans->upper->nest_level == nestDepth - 1)
614 if (
trans->truncdropped)
619 trans->upper->tuples_inserted =
trans->tuples_inserted;
620 trans->upper->tuples_updated =
trans->tuples_updated;
621 trans->upper->tuples_deleted =
trans->tuples_deleted;
625 trans->upper->tuples_inserted +=
trans->tuples_inserted;
626 trans->upper->tuples_updated +=
trans->tuples_updated;
627 trans->upper->tuples_deleted +=
trans->tuples_deleted;
647 trans->nest_level = nestDepth - 1;
665 trans->tuples_inserted +
trans->tuples_updated;
688 tabstat =
trans->parent;
697 record.
id = tabstat->id;
698 record.
shared = tabstat->shared;
723 tabstat =
trans->parent;
724 tabstat->
trans = NULL;
827 tabentry = &shtabstats->
stats;
905 pending->
id = rel_id;
906 pending->
shared = isshared;
930 trans->nest_level = nest_level;
932 trans->parent = pgstat_info;
946 if (pgstat_info->
trans == NULL ||
963 if (!
trans->truncdropped || is_drop)
965 trans->inserted_pre_truncdrop =
trans->tuples_inserted;
966 trans->updated_pre_truncdrop =
trans->tuples_updated;
967 trans->deleted_pre_truncdrop =
trans->tuples_deleted;
968 trans->truncdropped =
true;
978 if (
trans->truncdropped)
980 trans->tuples_inserted =
trans->inserted_pre_truncdrop;
981 trans->tuples_updated =
trans->updated_pre_truncdrop;
982 trans->tuples_deleted =
trans->deleted_pre_truncdrop;
TimestampTz GetCurrentTimestamp(void)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
bool IsSharedRelation(Oid relationId)
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_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len)
static PgStat_TableStatus * pgstat_prep_relation_pending(Oid rel_id, bool isshared)
void pgstat_assoc_relation(Relation rel)
void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter)
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)
void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len)
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_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, 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
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
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]