PostgreSQL Source Code git master
|
#include "postgres.h"
#include <math.h>
#include "access/syncscan.h"
#include "access/tableam.h"
#include "access/xact.h"
#include "optimizer/plancat.h"
#include "port/pg_bitutils.h"
#include "storage/bufmgr.h"
#include "storage/shmem.h"
#include "storage/smgr.h"
Go to the source code of this file.
Macros | |
#define | PARALLEL_SEQSCAN_NCHUNKS 2048 |
#define | PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS 64 |
#define | PARALLEL_SEQSCAN_MAX_CHUNK_SIZE 8192 |
Variables | |
char * | default_table_access_method = DEFAULT_TABLE_ACCESS_METHOD |
bool | synchronize_seqscans = true |
void simple_table_tuple_delete | ( | Relation | rel, |
ItemPointer | tid, | ||
Snapshot | snapshot | ||
) |
Definition at line 290 of file tableam.c.
References elog, ERROR, GetCurrentCommandId(), InvalidSnapshot, table_tuple_delete(), TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.
Referenced by ExecSimpleRelationDelete().
void simple_table_tuple_insert | ( | Relation | rel, |
TupleTableSlot * | slot | ||
) |
Definition at line 276 of file tableam.c.
References GetCurrentCommandId(), and table_tuple_insert().
Referenced by ExecSimpleRelationInsert().
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.
References elog, ERROR, GetCurrentCommandId(), InvalidSnapshot, table_tuple_update(), TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.
Referenced by ExecSimpleRelationUpdate().
TableScanDesc table_beginscan_catalog | ( | Relation | relation, |
int | nkeys, | ||
struct ScanKeyData * | key | ||
) |
Definition at line 112 of file tableam.c.
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(), objectsInSchemaToOids(), populate_typ_list(), ReindexMultipleTables(), remove_dbtablespaces(), RemoveSubscriptionRel(), RenameTableSpace(), ThereIsAtLeastOneRole(), and vac_truncate_clog().
TableScanDesc table_beginscan_parallel | ( | Relation | relation, |
ParallelTableScanDesc | pscan | ||
) |
Definition at line 165 of file tableam.c.
References Assert, ParallelTableScanDescData::phs_locator, ParallelTableScanDescData::phs_snapshot_any, ParallelTableScanDescData::phs_snapshot_off, RelationData::rd_locator, RelationData::rd_tableam, RegisterSnapshot(), RelFileLocatorEquals, 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().
Size table_block_parallelscan_initialize | ( | Relation | rel, |
ParallelTableScanDesc | pscan | ||
) |
Definition at line 388 of file tableam.c.
References ParallelBlockTableScanDescData::base, InvalidBlockNumber, NBuffers, pg_atomic_init_u64(), ParallelTableScanDescData::phs_locator, ParallelBlockTableScanDescData::phs_mutex, ParallelBlockTableScanDescData::phs_nallocated, ParallelBlockTableScanDescData::phs_nblocks, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, RelationData::rd_locator, RelationGetNumberOfBlocks, RelationUsesLocalBuffers, SpinLockInit, and synchronize_seqscans.
BlockNumber table_block_parallelscan_nextpage | ( | Relation | rel, |
ParallelBlockTableScanWorker | pbscanwork, | ||
ParallelBlockTableScanDesc | pbscan | ||
) |
Definition at line 491 of file tableam.c.
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().
void table_block_parallelscan_reinitialize | ( | Relation | rel, |
ParallelTableScanDesc | pscan | ||
) |
Definition at line 406 of file tableam.c.
References pg_atomic_write_u64(), and ParallelBlockTableScanDescData::phs_nallocated.
void table_block_parallelscan_startblock_init | ( | Relation | rel, |
ParallelBlockTableScanWorker | pbscanwork, | ||
ParallelBlockTableScanDesc | pbscan | ||
) |
Definition at line 421 of file tableam.c.
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().
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.
References fillfactor, get_rel_data_width(), HEAP_DEFAULT_FILLFACTOR, if(), RelationData::rd_rel, RelationGetFillFactor, and RelationGetNumberOfBlocks.
Referenced by heapam_estimate_rel_size().
uint64 table_block_relation_size | ( | Relation | rel, |
ForkNumber | forkNumber | ||
) |
Definition at line 616 of file tableam.c.
References i, InvalidForkNumber, MAX_FORKNUM, RelationGetSmgr(), and smgrnblocks().
bool table_index_fetch_tuple_check | ( | Relation | rel, |
ItemPointer | tid, | ||
Snapshot | snapshot, | ||
bool * | all_dead | ||
) |
Definition at line 208 of file tableam.c.
References ExecDropSingleTupleTableSlot(), table_index_fetch_begin(), table_index_fetch_end(), table_index_fetch_tuple(), and table_slot_create().
Referenced by _bt_check_unique().
Definition at line 130 of file tableam.c.
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().
void table_parallelscan_initialize | ( | Relation | rel, |
ParallelTableScanDesc | pscan, | ||
Snapshot | snapshot | ||
) |
Definition at line 145 of file tableam.c.
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().
const TupleTableSlotOps * table_slot_callbacks | ( | Relation | relation | ) |
Definition at line 58 of file tableam.c.
References Assert, RelationData::rd_rel, RelationData::rd_tableam, TableAmRoutine::slot_callbacks, TTSOpsHeapTuple, and TTSOpsVirtual.
Referenced by ATRewriteTable(), ExecGetReturningSlot(), ExecGetTriggerNewSlot(), ExecGetTriggerOldSlot(), ExecInitBitmapHeapScan(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecInitSampleScan(), ExecInitSeqScan(), ExecInitTidRangeScan(), ExecInitTidScan(), and table_slot_create().
TupleTableSlot * table_slot_create | ( | Relation | relation, |
List ** | reglist | ||
) |
Definition at line 91 of file tableam.c.
References lappend(), MakeSingleTupleTableSlot(), RelationGetDescr, and table_slot_callbacks().
Referenced by acquire_sample_rows(), apply_handle_tuple_routing(), apply_handle_update_internal(), build_index_value_desc(), check_default_partition_contents(), check_exclusion_or_unique_constraint(), CopyFrom(), CopyMultiInsertInfoNextFreeSlot(), DoCopyTo(), EvalPlanQualSlot(), ExecCrossPartitionUpdate(), ExecInitInsertProjection(), ExecInitMerge(), ExecInitMergeTupleSlots(), ExecInitModifyTable(), ExecInitPartitionInfo(), ExecInitRoutingInfo(), ExecInitUpdateProjection(), FindConflictTuple(), 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().
void table_tuple_get_latest_tid | ( | TableScanDesc | scan, |
ItemPointer | tid | ||
) |
Definition at line 235 of file tableam.c.
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().
char* default_table_access_method = DEFAULT_TABLE_ACCESS_METHOD |
Definition at line 48 of file tableam.c.
Referenced by ATPrepSetAccessMethod(), and DefineRelation().
bool synchronize_seqscans = true |
Definition at line 49 of file tableam.c.
Referenced by initscan(), and table_block_parallelscan_initialize().