41 #define PARALLEL_SEQSCAN_NCHUNKS 2048 43 #define PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS 64 45 #define PARALLEL_SEQSCAN_MAX_CHUNK_SIZE 8192 64 else if (relation->
rd_rel->relkind == RELKIND_FOREIGN_TABLE)
83 relation->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
100 *reglist =
lappend(*reglist, slot);
198 parallel_scan, flags);
226 bool call_again =
false;
257 elog(
ERROR,
"unexpected table_tuple_get_latest_tid call during logical decoding");
265 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
266 errmsg(
"tid (%u, %u) is not valid for relation \"%s\"",
316 elog(
ERROR,
"tuple already updated by self");
324 elog(
ERROR,
"tuple concurrently updated");
328 elog(
ERROR,
"tuple concurrently deleted");
332 elog(
ERROR,
"unrecognized table_tuple_delete status: %u", result);
349 bool *update_indexes)
359 &tmfd, &lockmode, update_indexes);
365 elog(
ERROR,
"tuple already updated by self");
373 elog(
ERROR,
"tuple concurrently updated");
377 elog(
ERROR,
"tuple concurrently deleted");
381 elog(
ERROR,
"unrecognized table_tuple_update status: %u", result);
440 memset(pbscanwork, 0,
sizeof(*pbscanwork));
443 "pg_nextpower2_32 may be too small for non-standard BlockNumber width");
644 return nblocks * BLCKSZ;
671 Size overhead_bytes_per_tuple,
672 Size usable_bytes_per_page)
685 reltuples = (
double) rel->
rd_rel->reltuples;
712 !rel->
rd_rel->relhassubclass)
726 if (reltuples >= 0 && relpages > 0)
727 density = reltuples / (double) relpages;
747 tuple_width += overhead_bytes_per_tuple;
749 density = usable_bytes_per_page / tuple_width;
751 *tuples = rint(density * (
double) curpages);
759 if (relallvisible == 0 || curpages <= 0)
761 else if ((
double) relallvisible >= curpages)
764 *allvisfrac = (double) relallvisible / curpages;
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
pg_atomic_uint64 phs_nallocated
void table_scan_update_snapshot(TableScanDesc scan, Snapshot snapshot)
#define ItemPointerGetOffsetNumberNoCheck(pointer)
BlockNumber phs_startblock
bool synchronize_seqscans
Size(* parallelscan_estimate)(Relation rel)
void table_block_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
static uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
Snapshot RestoreSnapshot(char *start_address)
uint64 table_block_relation_size(Relation rel, ForkNumber forkNumber)
ParallelTableScanDescData base
Snapshot RegisterSnapshot(Snapshot snapshot)
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
#define RelationGetDescr(relation)
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
#define PARALLEL_SEQSCAN_MAX_CHUNK_SIZE
struct SMgrRelationData * rd_smgr
struct ParallelBlockTableScanDescData * ParallelBlockTableScanDesc
struct ParallelBlockTableScanDescData ParallelBlockTableScanDescData
#define SpinLockInit(lock)
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
const TupleTableSlotOps TTSOpsVirtual
Snapshot GetCatalogSnapshot(Oid relid)
void simple_table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, Snapshot snapshot, bool *update_indexes)
static IndexFetchTableData * table_index_fetch_begin(Relation rel)
#define DEFAULT_TABLE_ACCESS_METHOD
int errcode(int sqlerrcode)
Size table_block_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan)
static void table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Size(* parallelscan_initialize)(Relation rel, ParallelTableScanDesc pscan)
const TupleTableSlotOps *(* slot_callbacks)(Relation rel)
Size table_block_parallelscan_estimate(Relation rel)
#define RelationOpenSmgr(relation)
#define StaticAssertStmt(condition, errmessage)
#define SpinLockAcquire(lock)
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
void SerializeSnapshot(Snapshot snapshot, char *start_address)
TableScanDesc(* scan_begin)(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, ParallelTableScanDesc pscan, uint32 flags)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid)
static uint32 pg_nextpower2_32(uint32 num)
#define RelationGetRelationName(relation)
BlockNumber table_block_parallelscan_nextpage(Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
bool table_index_fetch_tuple_check(Relation rel, ItemPointer tid, Snapshot snapshot, bool *all_dead)
BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks)
void simple_table_tuple_delete(Relation rel, ItemPointer tid, Snapshot snapshot)
List * lappend(List *list, void *datum)
TableScanDesc table_beginscan_parallel(Relation relation, ParallelTableScanDesc parallel_scan)
TransactionId CheckXidAlive
#define SpinLockRelease(lock)
Size EstimateSnapshotSpace(Snapshot snap)
void table_block_relation_estimate_size(Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac, Size overhead_bytes_per_tuple, Size usable_bytes_per_page)
Size add_size(Size s1, Size s2)
static bool table_index_fetch_tuple(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
const struct TableAmRoutine * rd_tableam
#define RelationGetNumberOfBlocks(reln)
static TM_Result table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
#define PARALLEL_SEQSCAN_NCHUNKS
#define IsMVCCSnapshot(snapshot)
#define ereport(elevel,...)
#define PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS
Size table_parallelscan_estimate(Relation rel, Snapshot snapshot)
BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum)
#define Assert(condition)
void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot)
void(* tuple_get_latest_tid)(TableScanDesc scan, ItemPointer tid)
#define InvalidBlockNumber
void ss_report_location(Relation rel, BlockNumber location)
#define RelationUsesLocalBuffers(relation)
bool(* tuple_tid_valid)(TableScanDesc scan, ItemPointer tid)
struct SnapshotData * rs_snapshot
int errmsg(const char *fmt,...)
#define ItemPointerGetBlockNumberNoCheck(pointer)
int32 get_rel_data_width(Relation rel, int32 *attr_widths)
const TupleTableSlotOps TTSOpsHeapTuple
char * default_table_access_method
CommandId GetCurrentCommandId(bool used)
#define TransactionIdIsValid(xid)
static TM_Result table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, bool *update_indexes)
void table_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan, Snapshot snapshot)
static void table_index_fetch_end(struct IndexFetchTableData *scan)
uint32 phsw_chunk_remaining
#define RelationGetRelid(relation)
void table_block_parallelscan_startblock_init(Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)