PostgreSQL Source Code  git master
tableam.h File Reference
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/xact.h"
#include "executor/tuptable.h"
#include "storage/read_stream.h"
#include "utils/rel.h"
#include "utils/snapshot.h"
Include dependency graph for tableam.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TM_FailureData
 
struct  TM_IndexDelete
 
struct  TM_IndexStatus
 
struct  TM_IndexDeleteOp
 
struct  TableAmRoutine
 

Macros

#define DEFAULT_TABLE_ACCESS_METHOD   "heap"
 
#define TABLE_INSERT_SKIP_FSM   0x0002
 
#define TABLE_INSERT_FROZEN   0x0004
 
#define TABLE_INSERT_NO_LOGICAL   0x0008
 
#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS   (1 << 0)
 
#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION   (1 << 1)
 

Typedefs

typedef enum ScanOptions ScanOptions
 
typedef enum TM_Result TM_Result
 
typedef enum TU_UpdateIndexes TU_UpdateIndexes
 
typedef struct TM_FailureData TM_FailureData
 
typedef struct TM_IndexDelete TM_IndexDelete
 
typedef struct TM_IndexStatus TM_IndexStatus
 
typedef struct TM_IndexDeleteOp TM_IndexDeleteOp
 
typedef void(* IndexBuildCallback) (Relation index, ItemPointer tid, Datum *values, bool *isnull, bool tupleIsAlive, void *state)
 
typedef struct TableAmRoutine TableAmRoutine
 

Enumerations

enum  ScanOptions {
  SO_TYPE_SEQSCAN = 1 << 0 , SO_TYPE_BITMAPSCAN = 1 << 1 , SO_TYPE_SAMPLESCAN = 1 << 2 , SO_TYPE_TIDSCAN = 1 << 3 ,
  SO_TYPE_TIDRANGESCAN = 1 << 4 , SO_TYPE_ANALYZE = 1 << 5 , SO_ALLOW_STRAT = 1 << 6 , SO_ALLOW_SYNC = 1 << 7 ,
  SO_ALLOW_PAGEMODE = 1 << 8 , SO_TEMP_SNAPSHOT = 1 << 9 , SO_NEED_TUPLES = 1 << 10
}
 
enum  TM_Result {
  TM_Ok , TM_Invisible , TM_SelfModified , TM_Updated ,
  TM_Deleted , TM_BeingModified , TM_WouldBlock
}
 
enum  TU_UpdateIndexes { TU_None , TU_All , TU_Summarizing }
 

Functions

const TupleTableSlotOpstable_slot_callbacks (Relation relation)
 
TupleTableSlottable_slot_create (Relation relation, List **reglist)
 
static TableScanDesc table_beginscan (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key)
 
TableScanDesc table_beginscan_catalog (Relation relation, int nkeys, struct ScanKeyData *key)
 
static TableScanDesc table_beginscan_strat (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync)
 
static TableScanDesc table_beginscan_bm (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool need_tuple)
 
static TableScanDesc table_beginscan_sampling (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
 
static TableScanDesc table_beginscan_tid (Relation rel, Snapshot snapshot)
 
static TableScanDesc table_beginscan_analyze (Relation rel)
 
static void table_endscan (TableScanDesc scan)
 
static void table_rescan (TableScanDesc scan, struct ScanKeyData *key)
 
static void table_rescan_set_params (TableScanDesc scan, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
 
static bool table_scan_getnextslot (TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
 
static TableScanDesc table_beginscan_tidrange (Relation rel, Snapshot snapshot, ItemPointer mintid, ItemPointer maxtid)
 
static void table_rescan_tidrange (TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
 
static bool table_scan_getnextslot_tidrange (TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
 
Size table_parallelscan_estimate (Relation rel, Snapshot snapshot)
 
void table_parallelscan_initialize (Relation rel, ParallelTableScanDesc pscan, Snapshot snapshot)
 
TableScanDesc table_beginscan_parallel (Relation relation, ParallelTableScanDesc pscan)
 
static void table_parallelscan_reinitialize (Relation rel, ParallelTableScanDesc pscan)
 
static IndexFetchTableDatatable_index_fetch_begin (Relation rel)
 
static void table_index_fetch_reset (struct IndexFetchTableData *scan)
 
static void table_index_fetch_end (struct IndexFetchTableData *scan)
 
static bool table_index_fetch_tuple (struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
 
bool table_index_fetch_tuple_check (Relation rel, ItemPointer tid, Snapshot snapshot, bool *all_dead)
 
static bool table_tuple_fetch_row_version (Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
 
static bool table_tuple_tid_valid (TableScanDesc scan, ItemPointer tid)
 
void table_tuple_get_latest_tid (TableScanDesc scan, ItemPointer tid)
 
static bool table_tuple_satisfies_snapshot (Relation rel, TupleTableSlot *slot, Snapshot snapshot)
 
static TransactionId table_index_delete_tuples (Relation rel, TM_IndexDeleteOp *delstate)
 
static void table_tuple_insert (Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
 
static void table_tuple_insert_speculative (Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
 
static void table_tuple_complete_speculative (Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
 
static void table_multi_insert (Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate)
 
static TM_Result table_tuple_delete (Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
 
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, TU_UpdateIndexes *update_indexes)
 
static TM_Result table_tuple_lock (Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
 
static void table_finish_bulk_insert (Relation rel, int options)
 
static void table_relation_set_new_filelocator (Relation rel, const RelFileLocator *newrlocator, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
 
static void table_relation_nontransactional_truncate (Relation rel)
 
static void table_relation_copy_data (Relation rel, const RelFileLocator *newrlocator)
 
static void table_relation_copy_for_cluster (Relation OldTable, Relation NewTable, Relation OldIndex, bool use_sort, TransactionId OldestXmin, TransactionId *xid_cutoff, MultiXactId *multi_cutoff, double *num_tuples, double *tups_vacuumed, double *tups_recently_dead)
 
static void table_relation_vacuum (Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
 
static bool table_scan_analyze_next_block (TableScanDesc scan, ReadStream *stream)
 
static bool table_scan_analyze_next_tuple (TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot)
 
static double table_index_build_scan (Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool progress, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
 
static double table_index_build_range_scan (Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool anyvisible, bool progress, BlockNumber start_blockno, BlockNumber numblocks, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
 
static void table_index_validate_scan (Relation table_rel, Relation index_rel, struct IndexInfo *index_info, Snapshot snapshot, struct ValidateIndexState *state)
 
static uint64 table_relation_size (Relation rel, ForkNumber forkNumber)
 
static bool table_relation_needs_toast_table (Relation rel)
 
static Oid table_relation_toast_am (Relation rel)
 
static void table_relation_fetch_toast_slice (Relation toastrel, Oid valueid, int32 attrsize, int32 sliceoffset, int32 slicelength, struct varlena *result)
 
static void table_relation_estimate_size (Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac)
 
static bool table_scan_bitmap_next_block (TableScanDesc scan, struct TBMIterateResult *tbmres)
 
static bool table_scan_bitmap_next_tuple (TableScanDesc scan, struct TBMIterateResult *tbmres, TupleTableSlot *slot)
 
static bool table_scan_sample_next_block (TableScanDesc scan, struct SampleScanState *scanstate)
 
static bool table_scan_sample_next_tuple (TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
 
void simple_table_tuple_insert (Relation rel, TupleTableSlot *slot)
 
void simple_table_tuple_delete (Relation rel, ItemPointer tid, Snapshot snapshot)
 
void simple_table_tuple_update (Relation rel, ItemPointer otid, TupleTableSlot *slot, Snapshot snapshot, TU_UpdateIndexes *update_indexes)
 
Size table_block_parallelscan_estimate (Relation rel)
 
Size table_block_parallelscan_initialize (Relation rel, ParallelTableScanDesc pscan)
 
void table_block_parallelscan_reinitialize (Relation rel, ParallelTableScanDesc pscan)
 
BlockNumber table_block_parallelscan_nextpage (Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
 
void table_block_parallelscan_startblock_init (Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
 
uint64 table_block_relation_size (Relation rel, ForkNumber forkNumber)
 
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)
 
const TableAmRoutineGetTableAmRoutine (Oid amhandler)
 
const TableAmRoutineGetHeapamTableAmRoutine (void)
 

Variables

PGDLLIMPORT char * default_table_access_method
 
PGDLLIMPORT bool synchronize_seqscans
 

Macro Definition Documentation

◆ DEFAULT_TABLE_ACCESS_METHOD

#define DEFAULT_TABLE_ACCESS_METHOD   "heap"

Definition at line 29 of file tableam.h.

◆ TABLE_INSERT_FROZEN

#define TABLE_INSERT_FROZEN   0x0004

Definition at line 261 of file tableam.h.

◆ TABLE_INSERT_NO_LOGICAL

#define TABLE_INSERT_NO_LOGICAL   0x0008

Definition at line 262 of file tableam.h.

◆ TABLE_INSERT_SKIP_FSM

#define TABLE_INSERT_SKIP_FSM   0x0002

Definition at line 260 of file tableam.h.

◆ TUPLE_LOCK_FLAG_FIND_LAST_VERSION

#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION   (1 << 1)

Definition at line 268 of file tableam.h.

◆ TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS

#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS   (1 << 0)

Definition at line 266 of file tableam.h.

Typedef Documentation

◆ IndexBuildCallback

typedef void(* IndexBuildCallback) (Relation index, ItemPointer tid, Datum *values, bool *isnull, bool tupleIsAlive, void *state)

Definition at line 272 of file tableam.h.

◆ ScanOptions

typedef enum ScanOptions ScanOptions

◆ TableAmRoutine

◆ TM_FailureData

◆ TM_IndexDelete

◆ TM_IndexDeleteOp

◆ TM_IndexStatus

◆ TM_Result

typedef enum TM_Result TM_Result

◆ TU_UpdateIndexes

Enumeration Type Documentation

◆ ScanOptions

Enumerator
SO_TYPE_SEQSCAN 
SO_TYPE_BITMAPSCAN 
SO_TYPE_SAMPLESCAN 
SO_TYPE_TIDSCAN 
SO_TYPE_TIDRANGESCAN 
SO_TYPE_ANALYZE 
SO_ALLOW_STRAT 
SO_ALLOW_SYNC 
SO_ALLOW_PAGEMODE 
SO_TEMP_SNAPSHOT 
SO_NEED_TUPLES 

Definition at line 46 of file tableam.h.

47 {
48  /* one of SO_TYPE_* may be specified */
49  SO_TYPE_SEQSCAN = 1 << 0,
50  SO_TYPE_BITMAPSCAN = 1 << 1,
51  SO_TYPE_SAMPLESCAN = 1 << 2,
52  SO_TYPE_TIDSCAN = 1 << 3,
53  SO_TYPE_TIDRANGESCAN = 1 << 4,
54  SO_TYPE_ANALYZE = 1 << 5,
55 
56  /* several of SO_ALLOW_* may be specified */
57  /* allow or disallow use of access strategy */
58  SO_ALLOW_STRAT = 1 << 6,
59  /* report location to syncscan logic? */
60  SO_ALLOW_SYNC = 1 << 7,
61  /* verify visibility page-at-a-time? */
62  SO_ALLOW_PAGEMODE = 1 << 8,
63 
64  /* unregister snapshot at scan end? */
65  SO_TEMP_SNAPSHOT = 1 << 9,
66 
67  /*
68  * At the discretion of the table AM, bitmap table scans may be able to
69  * skip fetching a block from the table if none of the table data is
70  * needed. If table data may be needed, set SO_NEED_TUPLES.
71  */
72  SO_NEED_TUPLES = 1 << 10,
73 } ScanOptions;
ScanOptions
Definition: tableam.h:47
@ SO_ALLOW_STRAT
Definition: tableam.h:58
@ SO_TYPE_TIDRANGESCAN
Definition: tableam.h:53
@ SO_TYPE_ANALYZE
Definition: tableam.h:54
@ SO_TEMP_SNAPSHOT
Definition: tableam.h:65
@ SO_TYPE_TIDSCAN
Definition: tableam.h:52
@ SO_NEED_TUPLES
Definition: tableam.h:72
@ SO_ALLOW_PAGEMODE
Definition: tableam.h:62
@ SO_TYPE_SAMPLESCAN
Definition: tableam.h:51
@ SO_ALLOW_SYNC
Definition: tableam.h:60
@ SO_TYPE_SEQSCAN
Definition: tableam.h:49
@ SO_TYPE_BITMAPSCAN
Definition: tableam.h:50

◆ TM_Result

enum TM_Result
Enumerator
TM_Ok 
TM_Invisible 
TM_SelfModified 
TM_Updated 
TM_Deleted 
TM_BeingModified 
TM_WouldBlock 

Definition at line 79 of file tableam.h.

80 {
81  /*
82  * Signals that the action succeeded (i.e. update/delete performed, lock
83  * was acquired)
84  */
85  TM_Ok,
86 
87  /* The affected tuple wasn't visible to the relevant snapshot */
89 
90  /* The affected tuple was already modified by the calling backend */
92 
93  /*
94  * The affected tuple was updated by another transaction. This includes
95  * the case where tuple was moved to another partition.
96  */
97  TM_Updated,
98 
99  /* The affected tuple was deleted by another transaction */
100  TM_Deleted,
101 
102  /*
103  * The affected tuple is currently being modified by another session. This
104  * will only be returned if table_(update/delete/lock_tuple) are
105  * instructed not to wait.
106  */
108 
109  /* lock couldn't be acquired, action skipped. Only used by lock_tuple */
111 } TM_Result;
TM_Result
Definition: tableam.h:80
@ TM_Ok
Definition: tableam.h:85
@ TM_BeingModified
Definition: tableam.h:107
@ TM_Deleted
Definition: tableam.h:100
@ TM_WouldBlock
Definition: tableam.h:110
@ TM_Updated
Definition: tableam.h:97
@ TM_SelfModified
Definition: tableam.h:91
@ TM_Invisible
Definition: tableam.h:88

◆ TU_UpdateIndexes

Enumerator
TU_None 
TU_All 
TU_Summarizing 

Definition at line 117 of file tableam.h.

118 {
119  /* No indexed columns were updated (incl. TID addressing of tuple) */
120  TU_None,
121 
122  /* A non-summarizing indexed column was updated, or the TID has changed */
123  TU_All,
124 
125  /* Only summarized columns were updated, TID is unchanged */
TU_UpdateIndexes
Definition: tableam.h:118
@ TU_Summarizing
Definition: tableam.h:126
@ TU_All
Definition: tableam.h:123
@ TU_None
Definition: tableam.h:120

Function Documentation

◆ GetHeapamTableAmRoutine()

const TableAmRoutine* GetHeapamTableAmRoutine ( void  )

Definition at line 2653 of file heapam_handler.c.

2654 {
2655  return &heapam_methods;
2656 }
static const TableAmRoutine heapam_methods

References heapam_methods.

Referenced by formrdesc(), and heap_getnext().

◆ GetTableAmRoutine()

const TableAmRoutine* GetTableAmRoutine ( Oid  amhandler)

Definition at line 28 of file tableamapi.c.

29 {
30  Datum datum;
31  const TableAmRoutine *routine;
32 
33  datum = OidFunctionCall0(amhandler);
34  routine = (TableAmRoutine *) DatumGetPointer(datum);
35 
36  if (routine == NULL || !IsA(routine, TableAmRoutine))
37  elog(ERROR, "table access method handler %u did not return a TableAmRoutine struct",
38  amhandler);
39 
40  /*
41  * Assert that all required callbacks are present. That makes it a bit
42  * easier to keep AMs up to date, e.g. when forward porting them to a new
43  * major version.
44  */
45  Assert(routine->scan_begin != NULL);
46  Assert(routine->scan_end != NULL);
47  Assert(routine->scan_rescan != NULL);
48  Assert(routine->scan_getnextslot != NULL);
49 
50  Assert(routine->parallelscan_estimate != NULL);
51  Assert(routine->parallelscan_initialize != NULL);
52  Assert(routine->parallelscan_reinitialize != NULL);
53 
54  Assert(routine->index_fetch_begin != NULL);
55  Assert(routine->index_fetch_reset != NULL);
56  Assert(routine->index_fetch_end != NULL);
57  Assert(routine->index_fetch_tuple != NULL);
58 
59  Assert(routine->tuple_fetch_row_version != NULL);
60  Assert(routine->tuple_tid_valid != NULL);
61  Assert(routine->tuple_get_latest_tid != NULL);
62  Assert(routine->tuple_satisfies_snapshot != NULL);
63  Assert(routine->index_delete_tuples != NULL);
64 
65  Assert(routine->tuple_insert != NULL);
66 
67  /*
68  * Could be made optional, but would require throwing error during
69  * parse-analysis.
70  */
71  Assert(routine->tuple_insert_speculative != NULL);
72  Assert(routine->tuple_complete_speculative != NULL);
73 
74  Assert(routine->multi_insert != NULL);
75  Assert(routine->tuple_delete != NULL);
76  Assert(routine->tuple_update != NULL);
77  Assert(routine->tuple_lock != NULL);
78 
79  Assert(routine->relation_set_new_filelocator != NULL);
81  Assert(routine->relation_copy_data != NULL);
82  Assert(routine->relation_copy_for_cluster != NULL);
83  Assert(routine->relation_vacuum != NULL);
84  Assert(routine->scan_analyze_next_block != NULL);
85  Assert(routine->scan_analyze_next_tuple != NULL);
86  Assert(routine->index_build_range_scan != NULL);
87  Assert(routine->index_validate_scan != NULL);
88 
89  Assert(routine->relation_size != NULL);
90  Assert(routine->relation_needs_toast_table != NULL);
91 
92  Assert(routine->relation_estimate_size != NULL);
93 
94  /* optional, but one callback implies presence of the other */
95  Assert((routine->scan_bitmap_next_block == NULL) ==
96  (routine->scan_bitmap_next_tuple == NULL));
97  Assert(routine->scan_sample_next_block != NULL);
98  Assert(routine->scan_sample_next_tuple != NULL);
99 
100  return routine;
101 }
#define Assert(condition)
Definition: c.h:858
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:224
#define OidFunctionCall0(functionId)
Definition: fmgr.h:678
#define IsA(nodeptr, _type_)
Definition: nodes.h:158
uintptr_t Datum
Definition: postgres.h:64
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:312
Size(* parallelscan_initialize)(Relation rel, ParallelTableScanDesc pscan)
Definition: tableam.h:400
void(* relation_copy_data)(Relation rel, const RelFileLocator *newrlocator)
Definition: tableam.h:624
bool(* scan_sample_next_tuple)(TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
Definition: tableam.h:882
void(* index_fetch_reset)(struct IndexFetchTableData *data)
Definition: tableam.h:430
void(* tuple_complete_speculative)(Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
Definition: tableam.h:524
bool(* scan_bitmap_next_tuple)(TableScanDesc scan, struct TBMIterateResult *tbmres, TupleTableSlot *slot)
Definition: tableam.h:837
void(* parallelscan_reinitialize)(Relation rel, ParallelTableScanDesc pscan)
Definition: tableam.h:407
void(* tuple_get_latest_tid)(TableScanDesc scan, ItemPointer tid)
Definition: tableam.h:489
struct IndexFetchTableData *(* index_fetch_begin)(Relation rel)
Definition: tableam.h:424
void(* relation_copy_for_cluster)(Relation OldTable, Relation NewTable, Relation OldIndex, bool use_sort, TransactionId OldestXmin, TransactionId *xid_cutoff, MultiXactId *multi_cutoff, double *num_tuples, double *tups_vacuumed, double *tups_recently_dead)
Definition: tableam.h:628
void(* relation_estimate_size)(Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac)
Definition: tableam.h:782
double(* index_build_range_scan)(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool anyvisible, bool progress, BlockNumber start_blockno, BlockNumber numblocks, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
Definition: tableam.h:703
TableScanDesc(* scan_begin)(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, ParallelTableScanDesc pscan, uint32 flags)
Definition: tableam.h:328
bool(* relation_needs_toast_table)(Relation rel)
Definition: tableam.h:746
bool(* tuple_tid_valid)(TableScanDesc scan, ItemPointer tid)
Definition: tableam.h:482
void(* multi_insert)(Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate)
Definition: tableam.h:530
void(* scan_end)(TableScanDesc scan)
Definition: tableam.h:338
uint64(* relation_size)(Relation rel, ForkNumber forkNumber)
Definition: tableam.h:736
TM_Result(* tuple_lock)(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
Definition: tableam.h:556
bool(* scan_sample_next_block)(TableScanDesc scan, struct SampleScanState *scanstate)
Definition: tableam.h:866
void(* relation_nontransactional_truncate)(Relation rel)
Definition: tableam.h:616
TM_Result(* tuple_update)(Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes)
Definition: tableam.h:544
void(* tuple_insert)(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
Definition: tableam.h:511
void(* scan_rescan)(TableScanDesc scan, struct ScanKeyData *key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
Definition: tableam.h:344
bool(* tuple_fetch_row_version)(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
Definition: tableam.h:474
void(* relation_vacuum)(Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
Definition: tableam.h:654
bool(* scan_analyze_next_block)(TableScanDesc scan, ReadStream *stream)
Definition: tableam.h:685
Size(* parallelscan_estimate)(Relation rel)
Definition: tableam.h:393
void(* relation_set_new_filelocator)(Relation rel, const RelFileLocator *newrlocator, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
Definition: tableam.h:602
bool(* scan_analyze_next_tuple)(TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot)
Definition: tableam.h:696
TransactionId(* index_delete_tuples)(Relation rel, TM_IndexDeleteOp *delstate)
Definition: tableam.h:501
void(* index_fetch_end)(struct IndexFetchTableData *data)
Definition: tableam.h:435
bool(* index_fetch_tuple)(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
Definition: tableam.h:457
void(* tuple_insert_speculative)(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
Definition: tableam.h:516
TM_Result(* tuple_delete)(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
Definition: tableam.h:534
bool(* scan_bitmap_next_block)(TableScanDesc scan, struct TBMIterateResult *tbmres)
Definition: tableam.h:823
void(* index_validate_scan)(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, Snapshot snapshot, struct ValidateIndexState *state)
Definition: tableam.h:716
bool(* scan_getnextslot)(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
Definition: tableam.h:351
bool(* tuple_satisfies_snapshot)(Relation rel, TupleTableSlot *slot, Snapshot snapshot)
Definition: tableam.h:496

References Assert, DatumGetPointer(), elog, ERROR, TableAmRoutine::index_build_range_scan, TableAmRoutine::index_delete_tuples, TableAmRoutine::index_fetch_begin, TableAmRoutine::index_fetch_end, TableAmRoutine::index_fetch_reset, TableAmRoutine::index_fetch_tuple, TableAmRoutine::index_validate_scan, IsA, TableAmRoutine::multi_insert, OidFunctionCall0, TableAmRoutine::parallelscan_estimate, TableAmRoutine::parallelscan_initialize, TableAmRoutine::parallelscan_reinitialize, TableAmRoutine::relation_copy_data, TableAmRoutine::relation_copy_for_cluster, TableAmRoutine::relation_estimate_size, TableAmRoutine::relation_needs_toast_table, TableAmRoutine::relation_nontransactional_truncate, TableAmRoutine::relation_set_new_filelocator, TableAmRoutine::relation_size, TableAmRoutine::relation_vacuum, TableAmRoutine::scan_analyze_next_block, TableAmRoutine::scan_analyze_next_tuple, TableAmRoutine::scan_begin, TableAmRoutine::scan_bitmap_next_block, TableAmRoutine::scan_bitmap_next_tuple, TableAmRoutine::scan_end, TableAmRoutine::scan_getnextslot, TableAmRoutine::scan_rescan, TableAmRoutine::scan_sample_next_block, TableAmRoutine::scan_sample_next_tuple, TableAmRoutine::tuple_complete_speculative, TableAmRoutine::tuple_delete, TableAmRoutine::tuple_fetch_row_version, TableAmRoutine::tuple_get_latest_tid, TableAmRoutine::tuple_insert, TableAmRoutine::tuple_insert_speculative, TableAmRoutine::tuple_lock, TableAmRoutine::tuple_satisfies_snapshot, TableAmRoutine::tuple_tid_valid, and TableAmRoutine::tuple_update.

Referenced by InitTableAmRoutine().

◆ simple_table_tuple_delete()

void simple_table_tuple_delete ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot 
)

Definition at line 290 of file tableam.c.

291 {
292  TM_Result result;
293  TM_FailureData tmfd;
294 
295  result = table_tuple_delete(rel, tid,
296  GetCurrentCommandId(true),
297  snapshot, InvalidSnapshot,
298  true /* wait for commit */ ,
299  &tmfd, false /* changingPart */ );
300 
301  switch (result)
302  {
303  case TM_SelfModified:
304  /* Tuple was already updated in current command? */
305  elog(ERROR, "tuple already updated by self");
306  break;
307 
308  case TM_Ok:
309  /* done successfully */
310  break;
311 
312  case TM_Updated:
313  elog(ERROR, "tuple concurrently updated");
314  break;
315 
316  case TM_Deleted:
317  elog(ERROR, "tuple concurrently deleted");
318  break;
319 
320  default:
321  elog(ERROR, "unrecognized table_tuple_delete status: %u", result);
322  break;
323  }
324 }
#define InvalidSnapshot
Definition: snapshot.h:123
static TM_Result table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
Definition: tableam.h:1501
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:826

References elog, ERROR, GetCurrentCommandId(), InvalidSnapshot, table_tuple_delete(), TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.

Referenced by ExecSimpleRelationDelete().

◆ simple_table_tuple_insert()

void simple_table_tuple_insert ( Relation  rel,
TupleTableSlot slot 
)

Definition at line 276 of file tableam.c.

277 {
278  table_tuple_insert(rel, slot, GetCurrentCommandId(true), 0, NULL);
279 }
static void table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
Definition: tableam.h:1412

References GetCurrentCommandId(), and table_tuple_insert().

Referenced by ExecSimpleRelationInsert().

◆ simple_table_tuple_update()

void simple_table_tuple_update ( Relation  rel,
ItemPointer  otid,
TupleTableSlot slot,
Snapshot  snapshot,
TU_UpdateIndexes update_indexes 
)

Definition at line 335 of file tableam.c.

339 {
340  TM_Result result;
341  TM_FailureData tmfd;
342  LockTupleMode lockmode;
343 
344  result = table_tuple_update(rel, otid, slot,
345  GetCurrentCommandId(true),
346  snapshot, InvalidSnapshot,
347  true /* wait for commit */ ,
348  &tmfd, &lockmode, update_indexes);
349 
350  switch (result)
351  {
352  case TM_SelfModified:
353  /* Tuple was already updated in current command? */
354  elog(ERROR, "tuple already updated by self");
355  break;
356 
357  case TM_Ok:
358  /* done successfully */
359  break;
360 
361  case TM_Updated:
362  elog(ERROR, "tuple concurrently updated");
363  break;
364 
365  case TM_Deleted:
366  elog(ERROR, "tuple concurrently deleted");
367  break;
368 
369  default:
370  elog(ERROR, "unrecognized table_tuple_update status: %u", result);
371  break;
372  }
373 }
LockTupleMode
Definition: lockoptions.h:50
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, TU_UpdateIndexes *update_indexes)
Definition: tableam.h:1545

References elog, ERROR, GetCurrentCommandId(), InvalidSnapshot, table_tuple_update(), TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.

Referenced by ExecSimpleRelationUpdate().

◆ table_beginscan()

◆ table_beginscan_analyze()

static TableScanDesc table_beginscan_analyze ( Relation  rel)
inlinestatic

Definition at line 1018 of file tableam.h.

1019 {
1020  uint32 flags = SO_TYPE_ANALYZE;
1021 
1022  return rel->rd_tableam->scan_begin(rel, NULL, 0, NULL, NULL, flags);
1023 }

References RelationData::rd_tableam, TableAmRoutine::scan_begin, and SO_TYPE_ANALYZE.

Referenced by acquire_sample_rows().

◆ table_beginscan_bm()

static TableScanDesc table_beginscan_bm ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key,
bool  need_tuple 
)
inlinestatic

Definition at line 963 of file tableam.h.

965 {
967 
968  if (need_tuple)
969  flags |= SO_NEED_TUPLES;
970 
971  return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
972 }

References sort-test::key, RelationData::rd_tableam, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_NEED_TUPLES, and SO_TYPE_BITMAPSCAN.

Referenced by BitmapHeapNext().

◆ table_beginscan_catalog()

TableScanDesc table_beginscan_catalog ( Relation  relation,
int  nkeys,
struct ScanKeyData key 
)

Definition at line 112 of file tableam.c.

113 {
114  uint32 flags = SO_TYPE_SEQSCAN |
116  Oid relid = RelationGetRelid(relation);
117  Snapshot snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));
118 
119  return relation->rd_tableam->scan_begin(relation, snapshot, nkeys, key,
120  NULL, flags);
121 }
unsigned int Oid
Definition: postgres_ext.h:31
#define RelationGetRelid(relation)
Definition: rel.h:505
Snapshot GetCatalogSnapshot(Oid relid)
Definition: snapmgr.c:352
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:794

References GetCatalogSnapshot(), sort-test::key, RelationData::rd_tableam, RegisterSnapshot(), RelationGetRelid, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, SO_TEMP_SNAPSHOT, and SO_TYPE_SEQSCAN.

Referenced by AlterTableMoveAll(), AlterTableSpaceOptions(), check_db_file_conflict(), CreateDatabaseUsingFileCopy(), do_autovacuum(), DropSetting(), DropTableSpace(), find_typed_table_dependencies(), get_all_vacuum_rels(), get_database_list(), get_subscription_list(), get_tables_to_cluster(), get_tablespace_name(), get_tablespace_oid(), GetAllTablesPublicationRelations(), getRelationsInNamespace(), GetSchemaPublicationRelations(), index_update_stats(), objectsInSchemaToOids(), populate_typ_list(), ReindexMultipleTables(), remove_dbtablespaces(), RemoveSubscriptionRel(), RenameTableSpace(), ThereIsAtLeastOneRole(), and vac_truncate_clog().

◆ table_beginscan_parallel()

TableScanDesc table_beginscan_parallel ( Relation  relation,
ParallelTableScanDesc  pscan 
)

Definition at line 165 of file tableam.c.

166 {
167  Snapshot snapshot;
168  uint32 flags = SO_TYPE_SEQSCAN |
170 
171  Assert(RelationGetRelid(relation) == pscan->phs_relid);
172 
173  if (!pscan->phs_snapshot_any)
174  {
175  /* Snapshot was serialized -- restore it */
176  snapshot = RestoreSnapshot((char *) pscan + pscan->phs_snapshot_off);
177  RegisterSnapshot(snapshot);
178  flags |= SO_TEMP_SNAPSHOT;
179  }
180  else
181  {
182  /* SnapshotAny passed by caller (not serialized) */
183  snapshot = SnapshotAny;
184  }
185 
186  return relation->rd_tableam->scan_begin(relation, snapshot, 0, NULL,
187  pscan, flags);
188 }
Snapshot RestoreSnapshot(char *start_address)
Definition: snapmgr.c:1775
#define SnapshotAny
Definition: snapmgr.h:33

References Assert, ParallelTableScanDescData::phs_relid, ParallelTableScanDescData::phs_snapshot_any, ParallelTableScanDescData::phs_snapshot_off, RelationData::rd_tableam, RegisterSnapshot(), RelationGetRelid, RestoreSnapshot(), TableAmRoutine::scan_begin, SnapshotAny, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, SO_TEMP_SNAPSHOT, and SO_TYPE_SEQSCAN.

Referenced by _brin_parallel_scan_and_build(), _bt_parallel_scan_and_sort(), ExecSeqScanInitializeDSM(), and ExecSeqScanInitializeWorker().

◆ table_beginscan_sampling()

static TableScanDesc table_beginscan_sampling ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key,
bool  allow_strat,
bool  allow_sync,
bool  allow_pagemode 
)
inlinestatic

Definition at line 982 of file tableam.h.

986 {
987  uint32 flags = SO_TYPE_SAMPLESCAN;
988 
989  if (allow_strat)
990  flags |= SO_ALLOW_STRAT;
991  if (allow_sync)
992  flags |= SO_ALLOW_SYNC;
993  if (allow_pagemode)
994  flags |= SO_ALLOW_PAGEMODE;
995 
996  return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
997 }

References sort-test::key, RelationData::rd_tableam, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, and SO_TYPE_SAMPLESCAN.

Referenced by tablesample_init().

◆ table_beginscan_strat()

static TableScanDesc table_beginscan_strat ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key,
bool  allow_strat,
bool  allow_sync 
)
inlinestatic

Definition at line 942 of file tableam.h.

945 {
947 
948  if (allow_strat)
949  flags |= SO_ALLOW_STRAT;
950  if (allow_sync)
951  flags |= SO_ALLOW_SYNC;
952 
953  return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
954 }

References sort-test::key, RelationData::rd_tableam, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, and SO_TYPE_SEQSCAN.

Referenced by bt_check_every_level(), heapam_index_build_range_scan(), heapam_index_validate_scan(), IndexCheckExclusion(), pgstat_heap(), and systable_beginscan().

◆ table_beginscan_tid()

static TableScanDesc table_beginscan_tid ( Relation  rel,
Snapshot  snapshot 
)
inlinestatic

Definition at line 1005 of file tableam.h.

1006 {
1007  uint32 flags = SO_TYPE_TIDSCAN;
1008 
1009  return rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags);
1010 }

References RelationData::rd_tableam, TableAmRoutine::scan_begin, and SO_TYPE_TIDSCAN.

Referenced by currtid_internal(), and TidListEval().

◆ table_beginscan_tidrange()

static TableScanDesc table_beginscan_tidrange ( Relation  rel,
Snapshot  snapshot,
ItemPointer  mintid,
ItemPointer  maxtid 
)
inlinestatic

Definition at line 1094 of file tableam.h.

1097 {
1098  TableScanDesc sscan;
1100 
1101  sscan = rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags);
1102 
1103  /* Set the range of TIDs to scan */
1104  sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid);
1105 
1106  return sscan;
1107 }
void(* scan_set_tidrange)(TableScanDesc scan, ItemPointer mintid, ItemPointer maxtid)
Definition: tableam.h:372
Relation rs_rd
Definition: relscan.h:34

References RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_begin, TableAmRoutine::scan_set_tidrange, SO_ALLOW_PAGEMODE, and SO_TYPE_TIDRANGESCAN.

Referenced by TidRangeNext().

◆ table_block_parallelscan_estimate()

Size table_block_parallelscan_estimate ( Relation  rel)

Definition at line 382 of file tableam.c.

383 {
384  return sizeof(ParallelBlockTableScanDescData);
385 }
struct ParallelBlockTableScanDescData ParallelBlockTableScanDescData

◆ table_block_parallelscan_initialize()

Size table_block_parallelscan_initialize ( Relation  rel,
ParallelTableScanDesc  pscan 
)

Definition at line 388 of file tableam.c.

389 {
391 
392  bpscan->base.phs_relid = RelationGetRelid(rel);
393  bpscan->phs_nblocks = RelationGetNumberOfBlocks(rel);
394  /* compare phs_syncscan initialization to similar logic in initscan */
396  !RelationUsesLocalBuffers(rel) &&
397  bpscan->phs_nblocks > NBuffers / 4;
398  SpinLockInit(&bpscan->phs_mutex);
400  pg_atomic_init_u64(&bpscan->phs_nallocated, 0);
401 
402  return sizeof(ParallelBlockTableScanDescData);
403 }
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: atomics.h:448
#define InvalidBlockNumber
Definition: block.h:33
#define RelationGetNumberOfBlocks(reln)
Definition: bufmgr.h:281
int NBuffers
Definition: globals.c:139
#define RelationUsesLocalBuffers(relation)
Definition: rel.h:637
struct ParallelBlockTableScanDescData * ParallelBlockTableScanDesc
Definition: relscan.h:85
#define SpinLockInit(lock)
Definition: spin.h:60
pg_atomic_uint64 phs_nallocated
Definition: relscan.h:82
ParallelTableScanDescData base
Definition: relscan.h:77
bool synchronize_seqscans
Definition: tableam.c:49

References ParallelBlockTableScanDescData::base, InvalidBlockNumber, NBuffers, pg_atomic_init_u64(), ParallelBlockTableScanDescData::phs_mutex, ParallelBlockTableScanDescData::phs_nallocated, ParallelBlockTableScanDescData::phs_nblocks, ParallelTableScanDescData::phs_relid, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, RelationGetNumberOfBlocks, RelationGetRelid, RelationUsesLocalBuffers, SpinLockInit, and synchronize_seqscans.

◆ table_block_parallelscan_nextpage()

BlockNumber table_block_parallelscan_nextpage ( Relation  rel,
ParallelBlockTableScanWorker  pbscanwork,
ParallelBlockTableScanDesc  pbscan 
)

Definition at line 491 of file tableam.c.

494 {
495  BlockNumber page;
496  uint64 nallocated;
497 
498  /*
499  * The logic below allocates block numbers out to parallel workers in a
500  * way that each worker will receive a set of consecutive block numbers to
501  * scan. Earlier versions of this would allocate the next highest block
502  * number to the next worker to call this function. This would generally
503  * result in workers never receiving consecutive block numbers. Some
504  * operating systems would not detect the sequential I/O pattern due to
505  * each backend being a different process which could result in poor
506  * performance due to inefficient or no readahead. To work around this
507  * issue, we now allocate a range of block numbers for each worker and
508  * when they come back for another block, we give them the next one in
509  * that range until the range is complete. When the worker completes the
510  * range of blocks we then allocate another range for it and return the
511  * first block number from that range.
512  *
513  * Here we name these ranges of blocks "chunks". The initial size of
514  * these chunks is determined in table_block_parallelscan_startblock_init
515  * based on the size of the relation. Towards the end of the scan, we
516  * start making reductions in the size of the chunks in order to attempt
517  * to divide the remaining work over all the workers as evenly as
518  * possible.
519  *
520  * Here pbscanwork is local worker memory. phsw_chunk_remaining tracks
521  * the number of blocks remaining in the chunk. When that reaches 0 then
522  * we must allocate a new chunk for the worker.
523  *
524  * phs_nallocated tracks how many blocks have been allocated to workers
525  * already. When phs_nallocated >= rs_nblocks, all blocks have been
526  * allocated.
527  *
528  * Because we use an atomic fetch-and-add to fetch the current value, the
529  * phs_nallocated counter will exceed rs_nblocks, because workers will
530  * still increment the value, when they try to allocate the next block but
531  * all blocks have been allocated already. The counter must be 64 bits
532  * wide because of that, to avoid wrapping around when rs_nblocks is close
533  * to 2^32.
534  *
535  * The actual block to return is calculated by adding the counter to the
536  * starting block number, modulo nblocks.
537  */
538 
539  /*
540  * First check if we have any remaining blocks in a previous chunk for
541  * this worker. We must consume all of the blocks from that before we
542  * allocate a new chunk to the worker.
543  */
544  if (pbscanwork->phsw_chunk_remaining > 0)
545  {
546  /*
547  * Give them the next block in the range and update the remaining
548  * number of blocks.
549  */
550  nallocated = ++pbscanwork->phsw_nallocated;
551  pbscanwork->phsw_chunk_remaining--;
552  }
553  else
554  {
555  /*
556  * When we've only got PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS chunks
557  * remaining in the scan, we half the chunk size. Since we reduce the
558  * chunk size here, we'll hit this again after doing
559  * PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS at the new size. After a few
560  * iterations of this, we'll end up doing the last few blocks with the
561  * chunk size set to 1.
562  */
563  if (pbscanwork->phsw_chunk_size > 1 &&
564  pbscanwork->phsw_nallocated > pbscan->phs_nblocks -
566  pbscanwork->phsw_chunk_size >>= 1;
567 
568  nallocated = pbscanwork->phsw_nallocated =
570  pbscanwork->phsw_chunk_size);
571 
572  /*
573  * Set the remaining number of blocks in this chunk so that subsequent
574  * calls from this worker continue on with this chunk until it's done.
575  */
576  pbscanwork->phsw_chunk_remaining = pbscanwork->phsw_chunk_size - 1;
577  }
578 
579  if (nallocated >= pbscan->phs_nblocks)
580  page = InvalidBlockNumber; /* all blocks have been allocated */
581  else
582  page = (nallocated + pbscan->phs_startblock) % pbscan->phs_nblocks;
583 
584  /*
585  * Report scan location. Normally, we report the current page number.
586  * When we reach the end of the scan, though, we report the starting page,
587  * not the ending page, just so the starting positions for later scans
588  * doesn't slew backwards. We only report the position at the end of the
589  * scan once, though: subsequent callers will report nothing.
590  */
591  if (pbscan->base.phs_syncscan)
592  {
593  if (page != InvalidBlockNumber)
594  ss_report_location(rel, page);
595  else if (nallocated == pbscan->phs_nblocks)
596  ss_report_location(rel, pbscan->phs_startblock);
597  }
598 
599  return page;
600 }
static uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
Definition: atomics.h:518
uint32 BlockNumber
Definition: block.h:31
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:77
void ss_report_location(Relation rel, BlockNumber location)
Definition: syncscan.c:289
#define PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS
Definition: tableam.c:43

References ParallelBlockTableScanDescData::base, if(), InvalidBlockNumber, PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS, pg_atomic_fetch_add_u64(), ParallelBlockTableScanDescData::phs_nallocated, ParallelBlockTableScanDescData::phs_nblocks, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, ParallelBlockTableScanWorkerData::phsw_chunk_remaining, ParallelBlockTableScanWorkerData::phsw_chunk_size, ParallelBlockTableScanWorkerData::phsw_nallocated, and ss_report_location().

Referenced by heap_scan_stream_read_next_parallel().

◆ table_block_parallelscan_reinitialize()

void table_block_parallelscan_reinitialize ( Relation  rel,
ParallelTableScanDesc  pscan 
)

Definition at line 406 of file tableam.c.

407 {
409 
410  pg_atomic_write_u64(&bpscan->phs_nallocated, 0);
411 }
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: atomics.h:480

References pg_atomic_write_u64(), and ParallelBlockTableScanDescData::phs_nallocated.

◆ table_block_parallelscan_startblock_init()

void table_block_parallelscan_startblock_init ( Relation  rel,
ParallelBlockTableScanWorker  pbscanwork,
ParallelBlockTableScanDesc  pbscan 
)

Definition at line 421 of file tableam.c.

424 {
425  BlockNumber sync_startpage = InvalidBlockNumber;
426 
427  /* Reset the state we use for controlling allocation size. */
428  memset(pbscanwork, 0, sizeof(*pbscanwork));
429 
430  StaticAssertStmt(MaxBlockNumber <= 0xFFFFFFFE,
431  "pg_nextpower2_32 may be too small for non-standard BlockNumber width");
432 
433  /*
434  * We determine the chunk size based on the size of the relation. First we
435  * split the relation into PARALLEL_SEQSCAN_NCHUNKS chunks but we then
436  * take the next highest power of 2 number of the chunk size. This means
437  * we split the relation into somewhere between PARALLEL_SEQSCAN_NCHUNKS
438  * and PARALLEL_SEQSCAN_NCHUNKS / 2 chunks.
439  */
440  pbscanwork->phsw_chunk_size = pg_nextpower2_32(Max(pbscan->phs_nblocks /
442 
443  /*
444  * Ensure we don't go over the maximum chunk size with larger tables. This
445  * means we may get much more than PARALLEL_SEQSCAN_NCHUNKS for larger
446  * tables. Too large a chunk size has been shown to be detrimental to
447  * synchronous scan performance.
448  */
449  pbscanwork->phsw_chunk_size = Min(pbscanwork->phsw_chunk_size,
451 
452 retry:
453  /* Grab the spinlock. */
454  SpinLockAcquire(&pbscan->phs_mutex);
455 
456  /*
457  * If the scan's startblock has not yet been initialized, we must do so
458  * now. If this is not a synchronized scan, we just start at block 0, but
459  * if it is a synchronized scan, we must get the starting position from
460  * the synchronized scan machinery. We can't hold the spinlock while
461  * doing that, though, so release the spinlock, get the information we
462  * need, and retry. If nobody else has initialized the scan in the
463  * meantime, we'll fill in the value we fetched on the second time
464  * through.
465  */
466  if (pbscan->phs_startblock == InvalidBlockNumber)
467  {
468  if (!pbscan->base.phs_syncscan)
469  pbscan->phs_startblock = 0;
470  else if (sync_startpage != InvalidBlockNumber)
471  pbscan->phs_startblock = sync_startpage;
472  else
473  {
474  SpinLockRelease(&pbscan->phs_mutex);
475  sync_startpage = ss_get_location(rel, pbscan->phs_nblocks);
476  goto retry;
477  }
478  }
479  SpinLockRelease(&pbscan->phs_mutex);
480 }
#define MaxBlockNumber
Definition: block.h:35
#define Min(x, y)
Definition: c.h:1004
#define Max(x, y)
Definition: c.h:998
#define StaticAssertStmt(condition, errmessage)
Definition: c.h:938
static uint32 pg_nextpower2_32(uint32 num)
Definition: pg_bitutils.h:189
#define SpinLockRelease(lock)
Definition: spin.h:64
#define SpinLockAcquire(lock)
Definition: spin.h:62
BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks)
Definition: syncscan.c:254
#define PARALLEL_SEQSCAN_MAX_CHUNK_SIZE
Definition: tableam.c:45
#define PARALLEL_SEQSCAN_NCHUNKS
Definition: tableam.c:41

References ParallelBlockTableScanDescData::base, InvalidBlockNumber, Max, MaxBlockNumber, Min, PARALLEL_SEQSCAN_MAX_CHUNK_SIZE, PARALLEL_SEQSCAN_NCHUNKS, pg_nextpower2_32(), ParallelBlockTableScanDescData::phs_mutex, ParallelBlockTableScanDescData::phs_nblocks, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, ParallelBlockTableScanWorkerData::phsw_chunk_size, SpinLockAcquire, SpinLockRelease, ss_get_location(), and StaticAssertStmt.

Referenced by heap_scan_stream_read_next_parallel().

◆ table_block_relation_estimate_size()

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 
)

Definition at line 653 of file tableam.c.

658 {
659  BlockNumber curpages;
660  BlockNumber relpages;
661  double reltuples;
662  BlockNumber relallvisible;
663  double density;
664 
665  /* it should have storage, so we can call the smgr */
666  curpages = RelationGetNumberOfBlocks(rel);
667 
668  /* coerce values in pg_class to more desirable types */
669  relpages = (BlockNumber) rel->rd_rel->relpages;
670  reltuples = (double) rel->rd_rel->reltuples;
671  relallvisible = (BlockNumber) rel->rd_rel->relallvisible;
672 
673  /*
674  * HACK: if the relation has never yet been vacuumed, use a minimum size
675  * estimate of 10 pages. The idea here is to avoid assuming a
676  * newly-created table is really small, even if it currently is, because
677  * that may not be true once some data gets loaded into it. Once a vacuum
678  * or analyze cycle has been done on it, it's more reasonable to believe
679  * the size is somewhat stable.
680  *
681  * (Note that this is only an issue if the plan gets cached and used again
682  * after the table has been filled. What we're trying to avoid is using a
683  * nestloop-type plan on a table that has grown substantially since the
684  * plan was made. Normally, autovacuum/autoanalyze will occur once enough
685  * inserts have happened and cause cached-plan invalidation; but that
686  * doesn't happen instantaneously, and it won't happen at all for cases
687  * such as temporary tables.)
688  *
689  * We test "never vacuumed" by seeing whether reltuples < 0.
690  *
691  * If the table has inheritance children, we don't apply this heuristic.
692  * Totally empty parent tables are quite common, so we should be willing
693  * to believe that they are empty.
694  */
695  if (curpages < 10 &&
696  reltuples < 0 &&
697  !rel->rd_rel->relhassubclass)
698  curpages = 10;
699 
700  /* report estimated # pages */
701  *pages = curpages;
702  /* quick exit if rel is clearly empty */
703  if (curpages == 0)
704  {
705  *tuples = 0;
706  *allvisfrac = 0;
707  return;
708  }
709 
710  /* estimate number of tuples from previous tuple density */
711  if (reltuples >= 0 && relpages > 0)
712  density = reltuples / (double) relpages;
713  else
714  {
715  /*
716  * When we have no data because the relation was never yet vacuumed,
717  * estimate tuple width from attribute datatypes. We assume here that
718  * the pages are completely full, which is OK for tables but is
719  * probably an overestimate for indexes. Fortunately
720  * get_relation_info() can clamp the overestimate to the parent
721  * table's size.
722  *
723  * Note: this code intentionally disregards alignment considerations,
724  * because (a) that would be gilding the lily considering how crude
725  * the estimate is, (b) it creates platform dependencies in the
726  * default plans which are kind of a headache for regression testing,
727  * and (c) different table AMs might use different padding schemes.
728  */
729  int32 tuple_width;
730  int fillfactor;
731 
732  /*
733  * Without reltuples/relpages, we also need to consider fillfactor.
734  * The other branch considers it implicitly by calculating density
735  * from actual relpages/reltuples statistics.
736  */
738 
739  tuple_width = get_rel_data_width(rel, attr_widths);
740  tuple_width += overhead_bytes_per_tuple;
741  /* note: integer division is intentional here */
742  density = (usable_bytes_per_page * fillfactor / 100) / tuple_width;
743  }
744  *tuples = rint(density * (double) curpages);
745 
746  /*
747  * We use relallvisible as-is, rather than scaling it up like we do for
748  * the pages and tuples counts, on the theory that any pages added since
749  * the last VACUUM are most likely not marked all-visible. But costsize.c
750  * wants it converted to a fraction.
751  */
752  if (relallvisible == 0 || curpages <= 0)
753  *allvisfrac = 0;
754  else if ((double) relallvisible >= curpages)
755  *allvisfrac = 1;
756  else
757  *allvisfrac = (double) relallvisible / curpages;
758 }
signed int int32
Definition: c.h:494
int fillfactor
Definition: pgbench.c:187
int32 get_rel_data_width(Relation rel, int32 *attr_widths)
Definition: plancat.c:1166
#define RelationGetFillFactor(relation, defaultff)
Definition: rel.h:363
#define HEAP_DEFAULT_FILLFACTOR
Definition: rel.h:349
Form_pg_class rd_rel
Definition: rel.h:111

References fillfactor, get_rel_data_width(), HEAP_DEFAULT_FILLFACTOR, if(), RelationData::rd_rel, RelationGetFillFactor, and RelationGetNumberOfBlocks.

Referenced by heapam_estimate_rel_size().

◆ table_block_relation_size()

uint64 table_block_relation_size ( Relation  rel,
ForkNumber  forkNumber 
)

Definition at line 616 of file tableam.c.

617 {
618  uint64 nblocks = 0;
619 
620  /* InvalidForkNumber indicates returning the size for all forks */
621  if (forkNumber == InvalidForkNumber)
622  {
623  for (int i = 0; i < MAX_FORKNUM; i++)
624  nblocks += smgrnblocks(RelationGetSmgr(rel), i);
625  }
626  else
627  nblocks = smgrnblocks(RelationGetSmgr(rel), forkNumber);
628 
629  return nblocks * BLCKSZ;
630 }
int i
Definition: isn.c:73
static SMgrRelation RelationGetSmgr(Relation rel)
Definition: rel.h:567
@ InvalidForkNumber
Definition: relpath.h:49
#define MAX_FORKNUM
Definition: relpath.h:62
BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum)
Definition: smgr.c:655

References i, InvalidForkNumber, MAX_FORKNUM, RelationGetSmgr(), and smgrnblocks().

◆ table_endscan()

◆ table_finish_bulk_insert()

static void table_finish_bulk_insert ( Relation  rel,
int  options 
)
inlinestatic

Definition at line 1605 of file tableam.h.

1606 {
1607  /* optional callback */
1608  if (rel->rd_tableam && rel->rd_tableam->finish_bulk_insert)
1610 }
void(* finish_bulk_insert)(Relation rel, int options)
Definition: tableam.h:578

References TableAmRoutine::finish_bulk_insert, and RelationData::rd_tableam.

Referenced by ATRewriteTable(), CopyMultiInsertBufferCleanup(), deleteSplitPartitionContext(), intorel_shutdown(), moveMergedTablesRows(), and transientrel_shutdown().

◆ table_index_build_range_scan()

static double table_index_build_range_scan ( Relation  table_rel,
Relation  index_rel,
struct IndexInfo index_info,
bool  allow_sync,
bool  anyvisible,
bool  progress,
BlockNumber  start_blockno,
BlockNumber  numblocks,
IndexBuildCallback  callback,
void *  callback_state,
TableScanDesc  scan 
)
inlinestatic

Definition at line 1818 of file tableam.h.

1829 {
1830  return table_rel->rd_tableam->index_build_range_scan(table_rel,
1831  index_rel,
1832  index_info,
1833  allow_sync,
1834  anyvisible,
1835  progress,
1836  start_blockno,
1837  numblocks,
1838  callback,
1839  callback_state,
1840  scan);
1841 }
int progress
Definition: pgbench.c:261
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:46

References callback(), TableAmRoutine::index_build_range_scan, progress, and RelationData::rd_tableam.

Referenced by summarize_range().

◆ table_index_build_scan()

static double table_index_build_scan ( Relation  table_rel,
Relation  index_rel,
struct IndexInfo index_info,
bool  allow_sync,
bool  progress,
IndexBuildCallback  callback,
void *  callback_state,
TableScanDesc  scan 
)
inlinestatic

Definition at line 1785 of file tableam.h.

1793 {
1794  return table_rel->rd_tableam->index_build_range_scan(table_rel,
1795  index_rel,
1796  index_info,
1797  allow_sync,
1798  false,
1799  progress,
1800  0,
1802  callback,
1803  callback_state,
1804  scan);
1805 }

References callback(), TableAmRoutine::index_build_range_scan, InvalidBlockNumber, progress, and RelationData::rd_tableam.

Referenced by _brin_parallel_scan_and_build(), _bt_parallel_scan_and_sort(), _bt_spools_heapscan(), blbuild(), brinbuild(), bt_check_every_level(), ginbuild(), gistbuild(), hashbuild(), and spgbuild().

◆ table_index_delete_tuples()

static TransactionId table_index_delete_tuples ( Relation  rel,
TM_IndexDeleteOp delstate 
)
inlinestatic

Definition at line 1366 of file tableam.h.

1367 {
1368  return rel->rd_tableam->index_delete_tuples(rel, delstate);
1369 }

References TableAmRoutine::index_delete_tuples, and RelationData::rd_tableam.

Referenced by _bt_delitems_delete_check(), and index_compute_xid_horizon_for_tuples().

◆ table_index_fetch_begin()

static IndexFetchTableData* table_index_fetch_begin ( Relation  rel)
inlinestatic

Definition at line 1202 of file tableam.h.

1203 {
1204  return rel->rd_tableam->index_fetch_begin(rel);
1205 }

References TableAmRoutine::index_fetch_begin, and RelationData::rd_tableam.

Referenced by index_beginscan(), index_beginscan_parallel(), and table_index_fetch_tuple_check().

◆ table_index_fetch_end()

static void table_index_fetch_end ( struct IndexFetchTableData scan)
inlinestatic

Definition at line 1221 of file tableam.h.

1222 {
1223  scan->rel->rd_tableam->index_fetch_end(scan);
1224 }

References TableAmRoutine::index_fetch_end, RelationData::rd_tableam, and IndexFetchTableData::rel.

Referenced by index_endscan(), and table_index_fetch_tuple_check().

◆ table_index_fetch_reset()

static void table_index_fetch_reset ( struct IndexFetchTableData scan)
inlinestatic

◆ table_index_fetch_tuple()

static bool table_index_fetch_tuple ( struct IndexFetchTableData scan,
ItemPointer  tid,
Snapshot  snapshot,
TupleTableSlot slot,
bool call_again,
bool all_dead 
)
inlinestatic

Definition at line 1251 of file tableam.h.

1256 {
1257  /*
1258  * We don't expect direct calls to table_index_fetch_tuple with valid
1259  * CheckXidAlive for catalog or regular tables. See detailed comments in
1260  * xact.c where these variables are declared.
1261  */
1263  elog(ERROR, "unexpected table_index_fetch_tuple call during logical decoding");
1264 
1265  return scan->rel->rd_tableam->index_fetch_tuple(scan, tid, snapshot,
1266  slot, call_again,
1267  all_dead);
1268 }
#define unlikely(x)
Definition: c.h:311
#define TransactionIdIsValid(xid)
Definition: transam.h:41
bool bsysscan
Definition: xact.c:98
TransactionId CheckXidAlive
Definition: xact.c:97

References bsysscan, CheckXidAlive, elog, ERROR, TableAmRoutine::index_fetch_tuple, RelationData::rd_tableam, IndexFetchTableData::rel, TransactionIdIsValid, and unlikely.

Referenced by index_fetch_heap(), and table_index_fetch_tuple_check().

◆ table_index_fetch_tuple_check()

bool table_index_fetch_tuple_check ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot,
bool all_dead 
)

Definition at line 208 of file tableam.c.

212 {
213  IndexFetchTableData *scan;
214  TupleTableSlot *slot;
215  bool call_again = false;
216  bool found;
217 
218  slot = table_slot_create(rel, NULL);
219  scan = table_index_fetch_begin(rel);
220  found = table_index_fetch_tuple(scan, tid, snapshot, slot, &call_again,
221  all_dead);
222  table_index_fetch_end(scan);
224 
225  return found;
226 }
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1341
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
Definition: tableam.c:91
static IndexFetchTableData * table_index_fetch_begin(Relation rel)
Definition: tableam.h:1202
static void table_index_fetch_end(struct IndexFetchTableData *scan)
Definition: tableam.h:1221
static bool table_index_fetch_tuple(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
Definition: tableam.h:1251

References ExecDropSingleTupleTableSlot(), table_index_fetch_begin(), table_index_fetch_end(), table_index_fetch_tuple(), and table_slot_create().

Referenced by _bt_check_unique().

◆ table_index_validate_scan()

static void table_index_validate_scan ( Relation  table_rel,
Relation  index_rel,
struct IndexInfo index_info,
Snapshot  snapshot,
struct ValidateIndexState state 
)
inlinestatic

Definition at line 1849 of file tableam.h.

1854 {
1855  table_rel->rd_tableam->index_validate_scan(table_rel,
1856  index_rel,
1857  index_info,
1858  snapshot,
1859  state);
1860 }
Definition: regguts.h:323

References TableAmRoutine::index_validate_scan, and RelationData::rd_tableam.

Referenced by validate_index().

◆ table_multi_insert()

static void table_multi_insert ( Relation  rel,
TupleTableSlot **  slots,
int  nslots,
CommandId  cid,
int  options,
struct BulkInsertStateData bistate 
)
inlinestatic

Definition at line 1467 of file tableam.h.

1469 {
1470  rel->rd_tableam->multi_insert(rel, slots, nslots,
1471  cid, options, bistate);
1472 }

References TableAmRoutine::multi_insert, and RelationData::rd_tableam.

Referenced by CopyMultiInsertBufferFlush().

◆ table_parallelscan_estimate()

Size table_parallelscan_estimate ( Relation  rel,
Snapshot  snapshot 
)

Definition at line 130 of file tableam.c.

131 {
132  Size sz = 0;
133 
134  if (IsMVCCSnapshot(snapshot))
135  sz = add_size(sz, EstimateSnapshotSpace(snapshot));
136  else
137  Assert(snapshot == SnapshotAny);
138 
139  sz = add_size(sz, rel->rd_tableam->parallelscan_estimate(rel));
140 
141  return sz;
142 }
size_t Size
Definition: c.h:605
Size add_size(Size s1, Size s2)
Definition: shmem.c:493
Size EstimateSnapshotSpace(Snapshot snapshot)
Definition: snapmgr.c:1692
#define IsMVCCSnapshot(snapshot)
Definition: snapmgr.h:62

References add_size(), Assert, EstimateSnapshotSpace(), IsMVCCSnapshot, TableAmRoutine::parallelscan_estimate, RelationData::rd_tableam, and SnapshotAny.

Referenced by _brin_parallel_estimate_shared(), _bt_parallel_estimate_shared(), and ExecSeqScanEstimate().

◆ table_parallelscan_initialize()

void table_parallelscan_initialize ( Relation  rel,
ParallelTableScanDesc  pscan,
Snapshot  snapshot 
)

Definition at line 145 of file tableam.c.

147 {
148  Size snapshot_off = rel->rd_tableam->parallelscan_initialize(rel, pscan);
149 
150  pscan->phs_snapshot_off = snapshot_off;
151 
152  if (IsMVCCSnapshot(snapshot))
153  {
154  SerializeSnapshot(snapshot, (char *) pscan + pscan->phs_snapshot_off);
155  pscan->phs_snapshot_any = false;
156  }
157  else
158  {
159  Assert(snapshot == SnapshotAny);
160  pscan->phs_snapshot_any = true;
161  }
162 }
void SerializeSnapshot(Snapshot snapshot, char *start_address)
Definition: snapmgr.c:1716

References Assert, IsMVCCSnapshot, TableAmRoutine::parallelscan_initialize, ParallelTableScanDescData::phs_snapshot_any, ParallelTableScanDescData::phs_snapshot_off, RelationData::rd_tableam, SerializeSnapshot(), and SnapshotAny.

Referenced by _brin_begin_parallel(), _bt_begin_parallel(), and ExecSeqScanInitializeDSM().

◆ table_parallelscan_reinitialize()

static void table_parallelscan_reinitialize ( Relation  rel,
ParallelTableScanDesc  pscan 
)
inlinestatic

Definition at line 1184 of file tableam.h.

1185 {
1186  rel->rd_tableam->parallelscan_reinitialize(rel, pscan);
1187 }

References TableAmRoutine::parallelscan_reinitialize, and RelationData::rd_tableam.

Referenced by ExecSeqScanReInitializeDSM().

◆ table_relation_copy_data()

static void table_relation_copy_data ( Relation  rel,
const RelFileLocator newrlocator 
)
inlinestatic

Definition at line 1661 of file tableam.h.

1662 {
1663  rel->rd_tableam->relation_copy_data(rel, newrlocator);
1664 }

References RelationData::rd_tableam, and TableAmRoutine::relation_copy_data.

Referenced by ATExecSetTableSpace().

◆ table_relation_copy_for_cluster()

static void table_relation_copy_for_cluster ( Relation  OldTable,
Relation  NewTable,
Relation  OldIndex,
bool  use_sort,
TransactionId  OldestXmin,
TransactionId xid_cutoff,
MultiXactId multi_cutoff,
double *  num_tuples,
double *  tups_vacuumed,
double *  tups_recently_dead 
)
inlinestatic

Definition at line 1688 of file tableam.h.

1697 {
1698  OldTable->rd_tableam->relation_copy_for_cluster(OldTable, NewTable, OldIndex,
1699  use_sort, OldestXmin,
1700  xid_cutoff, multi_cutoff,
1701  num_tuples, tups_vacuumed,
1702  tups_recently_dead);
1703 }

References RelationData::rd_tableam, and TableAmRoutine::relation_copy_for_cluster.

Referenced by copy_table_data().

◆ table_relation_estimate_size()

static void table_relation_estimate_size ( Relation  rel,
int32 attr_widths,
BlockNumber pages,
double *  tuples,
double *  allvisfrac 
)
inlinestatic

Definition at line 1947 of file tableam.h.

1950 {
1951  rel->rd_tableam->relation_estimate_size(rel, attr_widths, pages, tuples,
1952  allvisfrac);
1953 }

References RelationData::rd_tableam, and TableAmRoutine::relation_estimate_size.

Referenced by estimate_rel_size().

◆ table_relation_fetch_toast_slice()

static void table_relation_fetch_toast_slice ( Relation  toastrel,
Oid  valueid,
int32  attrsize,
int32  sliceoffset,
int32  slicelength,
struct varlena result 
)
inlinestatic

Definition at line 1926 of file tableam.h.

1929 {
1930  toastrel->rd_tableam->relation_fetch_toast_slice(toastrel, valueid,
1931  attrsize,
1932  sliceoffset, slicelength,
1933  result);
1934 }
void(* relation_fetch_toast_slice)(Relation toastrel, Oid valueid, int32 attrsize, int32 sliceoffset, int32 slicelength, struct varlena *result)
Definition: tableam.h:760

References RelationData::rd_tableam, and TableAmRoutine::relation_fetch_toast_slice.

Referenced by toast_fetch_datum(), and toast_fetch_datum_slice().

◆ table_relation_needs_toast_table()

static bool table_relation_needs_toast_table ( Relation  rel)
inlinestatic

Definition at line 1887 of file tableam.h.

1888 {
1889  return rel->rd_tableam->relation_needs_toast_table(rel);
1890 }

References RelationData::rd_tableam, and TableAmRoutine::relation_needs_toast_table.

Referenced by needs_toast_table().

◆ table_relation_nontransactional_truncate()

static void table_relation_nontransactional_truncate ( Relation  rel)
inlinestatic

Definition at line 1649 of file tableam.h.

1650 {
1652 }

References RelationData::rd_tableam, and TableAmRoutine::relation_nontransactional_truncate.

Referenced by heap_truncate_one_rel().

◆ table_relation_set_new_filelocator()

static void table_relation_set_new_filelocator ( Relation  rel,
const RelFileLocator newrlocator,
char  persistence,
TransactionId freezeXid,
MultiXactId minmulti 
)
inlinestatic

Definition at line 1631 of file tableam.h.

1636 {
1637  rel->rd_tableam->relation_set_new_filelocator(rel, newrlocator,
1638  persistence, freezeXid,
1639  minmulti);
1640 }

References RelationData::rd_tableam, and TableAmRoutine::relation_set_new_filelocator.

Referenced by heap_create(), and RelationSetNewRelfilenumber().

◆ table_relation_size()

static uint64 table_relation_size ( Relation  rel,
ForkNumber  forkNumber 
)
inlinestatic

Definition at line 1878 of file tableam.h.

1879 {
1880  return rel->rd_tableam->relation_size(rel, forkNumber);
1881 }

References RelationData::rd_tableam, and TableAmRoutine::relation_size.

Referenced by RelationGetNumberOfBlocksInFork().

◆ table_relation_toast_am()

static Oid table_relation_toast_am ( Relation  rel)
inlinestatic

Definition at line 1897 of file tableam.h.

1898 {
1899  return rel->rd_tableam->relation_toast_am(rel);
1900 }
Oid(* relation_toast_am)(Relation rel)
Definition: tableam.h:753

References RelationData::rd_tableam, and TableAmRoutine::relation_toast_am.

Referenced by create_toast_table().

◆ table_relation_vacuum()

static void table_relation_vacuum ( Relation  rel,
struct VacuumParams params,
BufferAccessStrategy  bstrategy 
)
inlinestatic

Definition at line 1717 of file tableam.h.

1719 {
1720  rel->rd_tableam->relation_vacuum(rel, params, bstrategy);
1721 }

References RelationData::rd_tableam, and TableAmRoutine::relation_vacuum.

Referenced by vacuum_rel().

◆ table_rescan()

static void table_rescan ( TableScanDesc  scan,
struct ScanKeyData key 
)
inlinestatic

Definition at line 1038 of file tableam.h.

1040 {
1041  scan->rs_rd->rd_tableam->scan_rescan(scan, key, false, false, false, false);
1042 }

References sort-test::key, RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_rescan.

Referenced by ExecReScanBitmapHeapScan(), ExecReScanSeqScan(), ExecReScanTidScan(), and RelationFindReplTupleSeq().

◆ table_rescan_set_params()

static void table_rescan_set_params ( TableScanDesc  scan,
struct ScanKeyData key,
bool  allow_strat,
bool  allow_sync,
bool  allow_pagemode 
)
inlinestatic

Definition at line 1053 of file tableam.h.

1055 {
1056  scan->rs_rd->rd_tableam->scan_rescan(scan, key, true,
1057  allow_strat, allow_sync,
1058  allow_pagemode);
1059 }

References sort-test::key, RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_rescan.

Referenced by tablesample_init().

◆ table_rescan_tidrange()

static void table_rescan_tidrange ( TableScanDesc  sscan,
ItemPointer  mintid,
ItemPointer  maxtid 
)
inlinestatic

Definition at line 1115 of file tableam.h.

1117 {
1118  /* Ensure table_beginscan_tidrange() was used. */
1119  Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0);
1120 
1121  sscan->rs_rd->rd_tableam->scan_rescan(sscan, NULL, false, false, false, false);
1122  sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid);
1123 }
uint32 rs_flags
Definition: relscan.h:47

References Assert, RelationData::rd_tableam, TableScanDescData::rs_flags, TableScanDescData::rs_rd, TableAmRoutine::scan_rescan, TableAmRoutine::scan_set_tidrange, and SO_TYPE_TIDRANGESCAN.

Referenced by TidRangeNext().

◆ table_scan_analyze_next_block()

static bool table_scan_analyze_next_block ( TableScanDesc  scan,
ReadStream stream 
)
inlinestatic

Definition at line 1732 of file tableam.h.

1733 {
1734  return scan->rs_rd->rd_tableam->scan_analyze_next_block(scan, stream);
1735 }

References RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_analyze_next_block.

Referenced by acquire_sample_rows().

◆ table_scan_analyze_next_tuple()

static bool table_scan_analyze_next_tuple ( TableScanDesc  scan,
TransactionId  OldestXmin,
double *  liverows,
double *  deadrows,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1748 of file tableam.h.

1751 {
1752  return scan->rs_rd->rd_tableam->scan_analyze_next_tuple(scan, OldestXmin,
1753  liverows, deadrows,
1754  slot);
1755 }

References RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_analyze_next_tuple.

Referenced by acquire_sample_rows().

◆ table_scan_bitmap_next_block()

static bool table_scan_bitmap_next_block ( TableScanDesc  scan,
struct TBMIterateResult tbmres 
)
inlinestatic

Definition at line 1971 of file tableam.h.

1973 {
1974  /*
1975  * We don't expect direct calls to table_scan_bitmap_next_block with valid
1976  * CheckXidAlive for catalog or regular tables. See detailed comments in
1977  * xact.c where these variables are declared.
1978  */
1980  elog(ERROR, "unexpected table_scan_bitmap_next_block call during logical decoding");
1981 
1982  return scan->rs_rd->rd_tableam->scan_bitmap_next_block(scan,
1983  tbmres);
1984 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_bitmap_next_block, TransactionIdIsValid, and unlikely.

Referenced by BitmapHeapNext().

◆ table_scan_bitmap_next_tuple()

static bool table_scan_bitmap_next_tuple ( TableScanDesc  scan,
struct TBMIterateResult tbmres,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1995 of file tableam.h.

1998 {
1999  /*
2000  * We don't expect direct calls to table_scan_bitmap_next_tuple with valid
2001  * CheckXidAlive for catalog or regular tables. See detailed comments in
2002  * xact.c where these variables are declared.
2003  */
2005  elog(ERROR, "unexpected table_scan_bitmap_next_tuple call during logical decoding");
2006 
2007  return scan->rs_rd->rd_tableam->scan_bitmap_next_tuple(scan,
2008  tbmres,
2009  slot);
2010 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_bitmap_next_tuple, TransactionIdIsValid, and unlikely.

Referenced by BitmapHeapNext().

◆ table_scan_getnextslot()

static bool table_scan_getnextslot ( TableScanDesc  sscan,
ScanDirection  direction,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1065 of file tableam.h.

1066 {
1067  slot->tts_tableOid = RelationGetRelid(sscan->rs_rd);
1068 
1069  /* We don't expect actual scans using NoMovementScanDirection */
1070  Assert(direction == ForwardScanDirection ||
1071  direction == BackwardScanDirection);
1072 
1073  /*
1074  * We don't expect direct calls to table_scan_getnextslot with valid
1075  * CheckXidAlive for catalog or regular tables. See detailed comments in
1076  * xact.c where these variables are declared.
1077  */
1079  elog(ERROR, "unexpected table_scan_getnextslot call during logical decoding");
1080 
1081  return sscan->rs_rd->rd_tableam->scan_getnextslot(sscan, direction, slot);
1082 }
@ BackwardScanDirection
Definition: sdir.h:26
@ ForwardScanDirection
Definition: sdir.h:28
Oid tts_tableOid
Definition: tuptable.h:130

References Assert, BackwardScanDirection, bsysscan, CheckXidAlive, elog, ERROR, ForwardScanDirection, RelationData::rd_tableam, RelationGetRelid, TableScanDescData::rs_rd, TableAmRoutine::scan_getnextslot, TransactionIdIsValid, TupleTableSlot::tts_tableOid, and unlikely.

Referenced by ATRewriteTable(), check_default_partition_contents(), DoCopyTo(), heapam_relation_copy_for_cluster(), IndexCheckExclusion(), moveMergedTablesRows(), moveSplitTableRows(), RelationFindReplTupleSeq(), SeqNext(), systable_getnext(), validateDomainCheckConstraint(), validateDomainNotNullConstraint(), and validateForeignKeyConstraint().

◆ table_scan_getnextslot_tidrange()

static bool table_scan_getnextslot_tidrange ( TableScanDesc  sscan,
ScanDirection  direction,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1131 of file tableam.h.

1133 {
1134  /* Ensure table_beginscan_tidrange() was used. */
1135  Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0);
1136 
1137  /* We don't expect actual scans using NoMovementScanDirection */
1138  Assert(direction == ForwardScanDirection ||
1139  direction == BackwardScanDirection);
1140 
1141  return sscan->rs_rd->rd_tableam->scan_getnextslot_tidrange(sscan,
1142  direction,
1143  slot);
1144 }
bool(* scan_getnextslot_tidrange)(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
Definition: tableam.h:380

References Assert, BackwardScanDirection, ForwardScanDirection, RelationData::rd_tableam, TableScanDescData::rs_flags, TableScanDescData::rs_rd, TableAmRoutine::scan_getnextslot_tidrange, and SO_TYPE_TIDRANGESCAN.

Referenced by TidRangeNext().

◆ table_scan_sample_next_block()

static bool table_scan_sample_next_block ( TableScanDesc  scan,
struct SampleScanState scanstate 
)
inlinestatic

Definition at line 2022 of file tableam.h.

2024 {
2025  /*
2026  * We don't expect direct calls to table_scan_sample_next_block with valid
2027  * CheckXidAlive for catalog or regular tables. See detailed comments in
2028  * xact.c where these variables are declared.
2029  */
2031  elog(ERROR, "unexpected table_scan_sample_next_block call during logical decoding");
2032  return scan->rs_rd->rd_tableam->scan_sample_next_block(scan, scanstate);
2033 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_sample_next_block, TransactionIdIsValid, and unlikely.

Referenced by tablesample_getnext().

◆ table_scan_sample_next_tuple()

static bool table_scan_sample_next_tuple ( TableScanDesc  scan,
struct SampleScanState scanstate,
TupleTableSlot slot 
)
inlinestatic

Definition at line 2044 of file tableam.h.

2047 {
2048  /*
2049  * We don't expect direct calls to table_scan_sample_next_tuple with valid
2050  * CheckXidAlive for catalog or regular tables. See detailed comments in
2051  * xact.c where these variables are declared.
2052  */
2054  elog(ERROR, "unexpected table_scan_sample_next_tuple call during logical decoding");
2055  return scan->rs_rd->rd_tableam->scan_sample_next_tuple(scan, scanstate,
2056  slot);
2057 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_sample_next_tuple, TransactionIdIsValid, and unlikely.

Referenced by tablesample_getnext().

◆ table_slot_callbacks()

const TupleTableSlotOps* table_slot_callbacks ( Relation  relation)

Definition at line 58 of file tableam.c.

59 {
60  const TupleTableSlotOps *tts_cb;
61 
62  if (relation->rd_tableam)
63  tts_cb = relation->rd_tableam->slot_callbacks(relation);
64  else if (relation->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
65  {
66  /*
67  * Historically FDWs expect to store heap tuples in slots. Continue
68  * handing them one, to make it less painful to adapt FDWs to new
69  * versions. The cost of a heap slot over a virtual slot is pretty
70  * small.
71  */
72  tts_cb = &TTSOpsHeapTuple;
73  }
74  else
75  {
76  /*
77  * These need to be supported, as some parts of the code (like COPY)
78  * need to create slots for such relations too. It seems better to
79  * centralize the knowledge that a heap slot is the right thing in
80  * that case here.
81  */
82  Assert(relation->rd_rel->relkind == RELKIND_VIEW ||
83  relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
84  tts_cb = &TTSOpsVirtual;
85  }
86 
87  return tts_cb;
88 }
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:84
const TupleTableSlotOps TTSOpsHeapTuple
Definition: execTuples.c:85
const TupleTableSlotOps *(* slot_callbacks)(Relation rel)
Definition: tableam.h:304

References Assert, RelationData::rd_rel, RelationData::rd_tableam, TableAmRoutine::slot_callbacks, TTSOpsHeapTuple, and TTSOpsVirtual.

Referenced by ATRewriteTable(), createSplitPartitionContext(), ExecGetReturningSlot(), ExecGetTriggerNewSlot(), ExecGetTriggerOldSlot(), ExecInitBitmapHeapScan(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecInitSampleScan(), ExecInitSeqScan(), ExecInitTidRangeScan(), ExecInitTidScan(), moveMergedTablesRows(), moveSplitTableRows(), and table_slot_create().

◆ table_slot_create()

TupleTableSlot* table_slot_create ( Relation  relation,
List **  reglist 
)

Definition at line 91 of file tableam.c.

92 {
93  const TupleTableSlotOps *tts_cb;
94  TupleTableSlot *slot;
95 
96  tts_cb = table_slot_callbacks(relation);
97  slot = MakeSingleTupleTableSlot(RelationGetDescr(relation), tts_cb);
98 
99  if (reglist)
100  *reglist = lappend(*reglist, slot);
101 
102  return slot;
103 }
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1325
List * lappend(List *list, void *datum)
Definition: list.c:339
#define RelationGetDescr(relation)
Definition: rel.h:531
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58

References lappend(), MakeSingleTupleTableSlot(), RelationGetDescr, and table_slot_callbacks().

Referenced by acquire_sample_rows(), apply_handle_tuple_routing(), check_default_partition_contents(), check_exclusion_or_unique_constraint(), CopyFrom(), CopyMultiInsertInfoNextFreeSlot(), DoCopyTo(), EvalPlanQualSlot(), ExecCrossPartitionUpdate(), ExecInitInsertProjection(), ExecInitMerge(), ExecInitMergeTupleSlots(), ExecInitModifyTable(), ExecInitPartitionInfo(), ExecInitRoutingInfo(), ExecInitUpdateProjection(), FindReplTupleInLocalRel(), get_actual_variable_range(), heap_entry_is_visible(), heapam_index_build_range_scan(), heapam_relation_copy_for_cluster(), IndexCheckExclusion(), RelationFindReplTupleSeq(), systable_beginscan(), systable_beginscan_ordered(), table_index_fetch_tuple_check(), validateDomainCheckConstraint(), validateDomainNotNullConstraint(), and validateForeignKeyConstraint().

◆ table_tuple_complete_speculative()

static void table_tuple_complete_speculative ( Relation  rel,
TupleTableSlot slot,
uint32  specToken,
bool  succeeded 
)
inlinestatic

Definition at line 1445 of file tableam.h.

1447 {
1448  rel->rd_tableam->tuple_complete_speculative(rel, slot, specToken,
1449  succeeded);
1450 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_complete_speculative.

Referenced by ExecInsert().

◆ table_tuple_delete()

static TM_Result table_tuple_delete ( Relation  rel,
ItemPointer  tid,
CommandId  cid,
Snapshot  snapshot,
Snapshot  crosscheck,
bool  wait,
TM_FailureData tmfd,
bool  changingPart 
)
inlinestatic

Definition at line 1501 of file tableam.h.

1504 {
1505  return rel->rd_tableam->tuple_delete(rel, tid, cid,
1506  snapshot, crosscheck,
1507  wait, tmfd, changingPart);
1508 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_delete.

Referenced by ExecDeleteAct(), and simple_table_tuple_delete().

◆ table_tuple_fetch_row_version()

static bool table_tuple_fetch_row_version ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1298 of file tableam.h.

1302 {
1303  /*
1304  * We don't expect direct calls to table_tuple_fetch_row_version with
1305  * valid CheckXidAlive for catalog or regular tables. See detailed
1306  * comments in xact.c where these variables are declared.
1307  */
1309  elog(ERROR, "unexpected table_tuple_fetch_row_version call during logical decoding");
1310 
1311  return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot);
1312 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TransactionIdIsValid, TableAmRoutine::tuple_fetch_row_version, and unlikely.

Referenced by AfterTriggerExecute(), EvalPlanQualFetchRowMark(), ExecCheckTIDVisible(), ExecCrossPartitionUpdate(), ExecDelete(), ExecMergeMatched(), ExecModifyTable(), ExecUpdate(), GetTupleForTrigger(), heap_entry_is_visible(), and TidNext().

◆ table_tuple_get_latest_tid()

void table_tuple_get_latest_tid ( TableScanDesc  scan,
ItemPointer  tid 
)

Definition at line 235 of file tableam.c.

236 {
237  Relation rel = scan->rs_rd;
238  const TableAmRoutine *tableam = rel->rd_tableam;
239 
240  /*
241  * We don't expect direct calls to table_tuple_get_latest_tid with valid
242  * CheckXidAlive for catalog or regular tables. See detailed comments in
243  * xact.c where these variables are declared.
244  */
246  elog(ERROR, "unexpected table_tuple_get_latest_tid call during logical decoding");
247 
248  /*
249  * Since this can be called with user-supplied TID, don't trust the input
250  * too much.
251  */
252  if (!tableam->tuple_tid_valid(scan, tid))
253  ereport(ERROR,
254  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
255  errmsg("tid (%u, %u) is not valid for relation \"%s\"",
258  RelationGetRelationName(rel))));
259 
260  tableam->tuple_get_latest_tid(scan, tid);
261 }
int errcode(int sqlerrcode)
Definition: elog.c:859
int errmsg(const char *fmt,...)
Definition: elog.c:1072
#define ereport(elevel,...)
Definition: elog.h:149
static OffsetNumber ItemPointerGetOffsetNumberNoCheck(const ItemPointerData *pointer)
Definition: itemptr.h:114
static BlockNumber ItemPointerGetBlockNumberNoCheck(const ItemPointerData *pointer)
Definition: itemptr.h:93
#define RelationGetRelationName(relation)
Definition: rel.h:539

References bsysscan, CheckXidAlive, elog, ereport, errcode(), errmsg(), ERROR, ItemPointerGetBlockNumberNoCheck(), ItemPointerGetOffsetNumberNoCheck(), RelationData::rd_tableam, RelationGetRelationName, TableScanDescData::rs_rd, TransactionIdIsValid, TableAmRoutine::tuple_get_latest_tid, TableAmRoutine::tuple_tid_valid, and unlikely.

Referenced by currtid_internal(), and TidNext().

◆ table_tuple_insert()

static void table_tuple_insert ( Relation  rel,
TupleTableSlot slot,
CommandId  cid,
int  options,
struct BulkInsertStateData bistate 
)
inlinestatic

◆ table_tuple_insert_speculative()

static void table_tuple_insert_speculative ( Relation  rel,
TupleTableSlot slot,
CommandId  cid,
int  options,
struct BulkInsertStateData bistate,
uint32  specToken 
)
inlinestatic

Definition at line 1431 of file tableam.h.

1435 {
1436  rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options,
1437  bistate, specToken);
1438 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_insert_speculative.

Referenced by ExecInsert().

◆ table_tuple_lock()

static TM_Result table_tuple_lock ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot,
TupleTableSlot slot,
CommandId  cid,
LockTupleMode  mode,
LockWaitPolicy  wait_policy,
uint8  flags,
TM_FailureData tmfd 
)
inlinestatic

Definition at line 1590 of file tableam.h.

1594 {
1595  return rel->rd_tableam->tuple_lock(rel, tid, snapshot, slot,
1596  cid, mode, wait_policy,
1597  flags, tmfd);
1598 }
static PgChecksumMode mode
Definition: pg_checksums.c:56

References mode, RelationData::rd_tableam, and TableAmRoutine::tuple_lock.

Referenced by ExecDelete(), ExecLockRows(), ExecMergeMatched(), ExecOnConflictUpdate(), ExecUpdate(), GetTupleForTrigger(), RelationFindReplTupleByIndex(), and RelationFindReplTupleSeq().

◆ table_tuple_satisfies_snapshot()

static bool table_tuple_satisfies_snapshot ( Relation  rel,
TupleTableSlot slot,
Snapshot  snapshot 
)
inlinestatic

Definition at line 1345 of file tableam.h.

1347 {
1348  return rel->rd_tableam->tuple_satisfies_snapshot(rel, slot, snapshot);
1349 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_satisfies_snapshot.

Referenced by ExecCheckTupleVisible(), RI_FKey_check(), and systable_recheck_tuple().

◆ table_tuple_tid_valid()

static bool table_tuple_tid_valid ( TableScanDesc  scan,
ItemPointer  tid 
)
inlinestatic

Definition at line 1324 of file tableam.h.

1325 {
1326  return scan->rs_rd->rd_tableam->tuple_tid_valid(scan, tid);
1327 }

References RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::tuple_tid_valid.

Referenced by TidListEval().

◆ table_tuple_update()

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,
TU_UpdateIndexes update_indexes 
)
inlinestatic

Definition at line 1545 of file tableam.h.

1549 {
1550  return rel->rd_tableam->tuple_update(rel, otid, slot,
1551  cid, snapshot, crosscheck,
1552  wait, tmfd,
1553  lockmode, update_indexes);
1554 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_update.

Referenced by ExecUpdateAct(), and simple_table_tuple_update().

Variable Documentation

◆ default_table_access_method

PGDLLIMPORT char* default_table_access_method
extern

Definition at line 48 of file tableam.c.

Referenced by ATPrepSetAccessMethod(), and DefineRelation().

◆ synchronize_seqscans

PGDLLIMPORT bool synchronize_seqscans
extern

Definition at line 49 of file tableam.c.

Referenced by initscan(), and table_block_parallelscan_initialize().