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_VERBOSE 0x01 /* print progress info */ |
#define | CLUOPT_RECHECK 0x02 /* recheck relation state */ |
#define | CLUOPT_RECHECK_ISCLUSTERED |
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, LOCKMODE lockmode) |
void | mark_index_clustered (Relation rel, Oid indexOid, bool is_internal) |
Oid | make_new_heap (Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod, 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 cutoffMulti, char newrelpersistence) |
#define CLUOPT_RECHECK_ISCLUSTERED |
typedef struct ClusterParams ClusterParams |
Definition at line 499 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(), cluster(), and cluster_rel().
void cluster | ( | ParseState * | pstate, |
ClusterStmt * | stmt, | ||
bool | isTopLevel | ||
) |
Definition at line 107 of file cluster.c.
References AccessExclusiveLock, AccessShareLock, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, check_index_is_clusterable(), CLUOPT_RECHECK, CLUOPT_RECHECK_ISCLUSTERED, CLUOPT_VERBOSE, cluster_multiple_rels(), cluster_rel(), defGetBoolean(), DefElem::defname, ereport, errcode(), errmsg(), ERROR, get_index_isclustered(), get_relname_relid(), get_tables_to_cluster(), get_tables_to_cluster_partitioned(), InvalidOid, lfirst, lfirst_oid, DefElem::location, MemoryContextDelete(), NoLock, OidIsValid, ClusterParams::options, parser_errposition(), PortalContext, PreventInTransactionBlock(), RangeVarCallbackMaintainsTable(), RangeVarGetRelidExtended(), RelationData::rd_rel, RELATION_IS_OTHER_TEMP, RelationGetIndexList(), StartTransactionCommand(), stmt, table_close(), table_open(), and verbose.
Referenced by adjust_data_dir(), check_bin_dir(), check_data_dir(), check_for_connection_status(), check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_is_install_user(), cluster_conn_opts(), connectToServer(), get_bin_version(), get_control_data(), get_db_conn(), get_db_infos(), get_db_rel_and_slot_infos(), get_major_server_version(), get_sock_dir(), get_subscription_count(), get_template0_info(), jsonb_9_4_check_applicable(), old_9_6_invalidate_hash_indexes(), process_query_result(), process_slot(), report_extension_updates(), set_tablespace_directory_suffix(), standard_ProcessUtility(), start_conn(), start_postmaster(), stop_postmaster(), and upgrade_task_run().
void cluster_rel | ( | Oid | tableOid, |
Oid | indexOid, | ||
ClusterParams * | params | ||
) |
Definition at line 310 of file cluster.c.
References AccessExclusiveLock, Assert, AtEOXact_GUC(), CHECK_FOR_INTERRUPTS, check_index_is_clusterable(), CheckTableNotInUse(), CLUOPT_RECHECK, CLUOPT_RECHECK_ISCLUSTERED, CLUOPT_VERBOSE, cluster_is_permitted_for_relation(), ereport, errcode(), errmsg(), ERROR, get_index_isclustered(), GetUserIdAndSecContext(), NewGUCNestLevel(), ObjectIdGetDatum(), OidIsValid, ClusterParams::options, 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, RestrictSearchPath(), SearchSysCacheExists1, SECURITY_RESTRICTED_OPERATION, SetUserIdAndSecContext(), TransferPredicateLocksToHeapRelation(), try_relation_open(), and verbose.
Referenced by cluster(), cluster_multiple_rels(), 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 | cutoffMulti, | ||
char | newrelpersistence | ||
) |
Definition at line 1437 of file cluster.c.
References CacheInvalidateCatalog(), CatalogTupleUpdate(), CommandCounterIncrement(), 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(), RenameRelationInternal(), ResetRelRewrite(), 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().
Oid make_new_heap | ( | Oid | OIDOldHeap, |
Oid | NewTableSpace, | ||
Oid | NewAccessMethod, | ||
char | relpersistence, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 687 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(), SearchSysCache1(), snprintf, SysCacheGetAttr(), table_close(), and table_open().
Referenced by ATRewriteTables(), rebuild_relation(), and RefreshMatViewByOid().
Definition at line 559 of file cluster.c.
References CatalogTupleUpdate(), elog, ereport, errcode(), errmsg(), ERROR, get_index_isclustered(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, 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().