PostgreSQL Source Code
git master
|
#include "nodes/parsenodes.h"
#include "parser/parse_node.h"
#include "storage/lock.h"
#include "utils/relcache.h"
Go to the source code of this file.
Data Structures | |
struct | ClusterParams |
Macros | |
#define | CLUOPT_RECHECK 0x01 /* recheck relation state */ |
#define | CLUOPT_VERBOSE 0x02 /* print progress info */ |
Typedefs | |
typedef struct ClusterParams | ClusterParams |
Functions | |
void | cluster (ParseState *pstate, ClusterStmt *stmt, bool isTopLevel) |
void | cluster_rel (Oid tableOid, Oid indexOid, ClusterParams *params) |
void | check_index_is_clusterable (Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode) |
void | mark_index_clustered (Relation rel, Oid indexOid, bool is_internal) |
Oid | make_new_heap (Oid OIDOldHeap, Oid NewTableSpace, char relpersistence, LOCKMODE lockmode) |
void | finish_heap_swap (Oid OIDOldHeap, Oid OIDNewHeap, bool is_system_catalog, bool swap_toast_by_content, bool check_constraints, bool is_internal, TransactionId frozenXid, MultiXactId minMulti, char newrelpersistence) |
#define CLUOPT_RECHECK 0x01 /* recheck relation state */ |
Definition at line 23 of file cluster.h.
Referenced by cluster(), and cluster_rel().
#define CLUOPT_VERBOSE 0x02 /* print progress info */ |
Definition at line 24 of file cluster.h.
Referenced by cluster(), cluster_rel(), and vacuum_rel().
typedef struct ClusterParams ClusterParams |
Definition at line 443 of file cluster.c.
References IndexAmRoutine::amclusterable, ereport, errcode(), errmsg(), ERROR, heap_attisnull(), index_close(), index_open(), NoLock, RelationData::rd_indam, RelationData::rd_index, RelationData::rd_indextuple, RelationGetRelationName, and RelationGetRelid.
Referenced by ATExecClusterOn(), and cluster_rel().
void cluster | ( | ParseState * | pstate, |
ClusterStmt * | stmt, | ||
bool | isTopLevel | ||
) |
Definition at line 103 of file cluster.c.
References AccessExclusiveLock, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CLUOPT_RECHECK, CLUOPT_VERBOSE, cluster_rel(), CommitTransactionCommand(), defGetBoolean(), DefElem::defname, ereport, errcode(), errmsg(), ERROR, get_index_isclustered(), get_relname_relid(), get_tables_to_cluster(), GetTransactionSnapshot(), ClusterStmt::indexname, RelToCluster::indexOid, InvalidOid, lfirst, lfirst_oid, DefElem::location, MemoryContextDelete(), NoLock, OidIsValid, ClusterParams::options, ClusterStmt::params, parser_errposition(), PopActiveSnapshot(), PortalContext, PreventInTransactionBlock(), PushActiveSnapshot(), RangeVarCallbackOwnsTable(), RangeVarGetRelidExtended(), RelationData::rd_rel, ClusterStmt::relation, RELATION_IS_OTHER_TEMP, RelationGetIndexList(), RangeVar::relname, StartTransactionCommand(), table_close(), table_open(), RelToCluster::tableOid, and verbose.
Referenced by standard_ProcessUtility(), start_postmaster(), and stop_postmaster().
void cluster_rel | ( | Oid | tableOid, |
Oid | indexOid, | ||
ClusterParams * | params | ||
) |
Definition at line 277 of file cluster.c.
References AccessExclusiveLock, CHECK_FOR_INTERRUPTS, check_index_is_clusterable(), CheckTableNotInUse(), CLUOPT_RECHECK, CLUOPT_VERBOSE, ereport, errcode(), errmsg(), ERROR, get_index_isclustered(), GetUserId(), ObjectIdGetDatum, OidIsValid, ClusterParams::options, pg_class_ownercheck(), pgstat_progress_end_command(), pgstat_progress_start_command(), pgstat_progress_update_param(), PROGRESS_CLUSTER_COMMAND, PROGRESS_CLUSTER_COMMAND_CLUSTER, PROGRESS_CLUSTER_COMMAND_VACUUM_FULL, PROGRESS_COMMAND_CLUSTER, RelationData::rd_rel, rebuild_relation(), relation_close(), RELATION_IS_OTHER_TEMP, RelationIsPopulated, RELOID, SearchSysCacheExists1, TransferPredicateLocksToHeapRelation(), try_relation_open(), and verbose.
Referenced by cluster(), and vacuum_rel().
void finish_heap_swap | ( | Oid | OIDOldHeap, |
Oid | OIDNewHeap, | ||
bool | is_system_catalog, | ||
bool | swap_toast_by_content, | ||
bool | check_constraints, | ||
bool | is_internal, | ||
TransactionId | frozenXid, | ||
MultiXactId | minMulti, | ||
char | newrelpersistence | ||
) |
Definition at line 1348 of file cluster.c.
References CacheInvalidateCatalog(), CatalogTupleUpdate(), DROP_RESTRICT, elog, ERROR, GETSTRUCT, HeapTupleIsValid, i, NAMEDATALEN, NoLock, ObjectIdGetDatum, OidIsValid, PERFORM_DELETION_INTERNAL, performDeletion(), pgstat_progress_update_param(), PROGRESS_CLUSTER_PHASE, PROGRESS_CLUSTER_PHASE_FINAL_CLEANUP, PROGRESS_CLUSTER_PHASE_REBUILD_INDEX, PROGRESS_CLUSTER_PHASE_SWAP_REL_FILES, RelationData::rd_rel, REINDEX_REL_CHECK_CONSTRAINTS, REINDEX_REL_FORCE_INDEXES_PERMANENT, REINDEX_REL_FORCE_INDEXES_UNLOGGED, REINDEX_REL_SUPPRESS_INDEX_USE, reindex_relation(), relation_close(), RelationClearMissing(), RelationMapRemoveMapping(), RELOID, RenameRelationInternal(), RowExclusiveLock, SearchSysCacheCopy1, snprintf, swap_relation_files(), HeapTupleData::t_self, table_close(), table_open(), and toast_get_valid_index().
Referenced by ATRewriteTables(), rebuild_relation(), and refresh_by_heap_swap().
Definition at line 629 of file cluster.c.
References Assert, CommandCounterIncrement(), elog, ERROR, heap_create_with_catalog(), HeapTupleIsValid, InvalidOid, LookupCreationNamespace(), NAMEDATALEN, NewHeapCreateToastTable(), NIL, NoLock, ObjectIdGetDatum, OidIsValid, ONCOMMIT_NOOP, RelationData::rd_rel, RelationGetDescr, RelationGetNamespace, RelationIsMapped, ReleaseSysCache(), RELOID, SearchSysCache1(), snprintf, SysCacheGetAttr(), table_close(), and table_open().
Referenced by ATRewriteTables(), ExecRefreshMatView(), and rebuild_relation().
Definition at line 503 of file cluster.c.
References CatalogTupleUpdate(), elog, ereport, errcode(), errmsg(), ERROR, get_index_isclustered(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, INDEXRELID, InvalidOid, InvokeObjectPostAlterHookArg, lfirst_oid, ObjectIdGetDatum, OidIsValid, RelationData::rd_rel, RelationGetIndexList(), RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecClusterOn(), ATExecDropCluster(), and rebuild_relation().