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 300 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 286 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 345 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(), index_update_stats(), 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 175 of file tableam.c.
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 _bt_parallel_scan_and_sort(), ExecSeqScanInitializeDSM(), and ExecSeqScanInitializeWorker().
Size table_block_parallelscan_initialize | ( | Relation | rel, |
ParallelTableScanDesc | pscan | ||
) |
Definition at line 398 of file tableam.c.
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.
BlockNumber table_block_parallelscan_nextpage | ( | Relation | rel, |
ParallelBlockTableScanWorker | pbscanwork, | ||
ParallelBlockTableScanDesc | pbscan | ||
) |
Definition at line 501 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 heapgettup_advance_block(), and heapgettup_initial_block().
void table_block_parallelscan_reinitialize | ( | Relation | rel, |
ParallelTableScanDesc | pscan | ||
) |
Definition at line 416 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 431 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 heapgettup_initial_block().
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 663 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 626 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 218 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 140 of file tableam.c.
References add_size(), Assert(), EstimateSnapshotSpace(), IsMVCCSnapshot, TableAmRoutine::parallelscan_estimate, RelationData::rd_tableam, and SnapshotAny.
Referenced by _bt_parallel_estimate_shared(), and ExecSeqScanEstimate().
void table_parallelscan_initialize | ( | Relation | rel, |
ParallelTableScanDesc | pscan, | ||
Snapshot | snapshot | ||
) |
Definition at line 155 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 _bt_begin_parallel(), and ExecSeqScanInitializeDSM().
void table_scan_update_snapshot | ( | TableScanDesc | scan, |
Snapshot | snapshot | ||
) |
Definition at line 124 of file tableam.c.
References Assert(), IsMVCCSnapshot, RegisterSnapshot(), TableScanDescData::rs_flags, TableScanDescData::rs_snapshot, and SO_TEMP_SNAPSHOT.
Referenced by ExecBitmapHeapInitializeWorker().
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(), AlterDomainNotNull(), 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(), heapam_index_build_range_scan(), heapam_relation_copy_for_cluster(), IndexCheckExclusion(), RelationFindReplTupleSeq(), systable_beginscan(), systable_beginscan_ordered(), table_index_fetch_tuple_check(), validateDomainConstraint(), and validateForeignKeyConstraint().
void table_tuple_get_latest_tid | ( | TableScanDesc | scan, |
ItemPointer | tid | ||
) |
Definition at line 245 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 DefineRelation().
Definition at line 49 of file tableam.c.
Referenced by initscan(), and table_block_parallelscan_initialize().