|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <time.h>#include "access/nbtree.h"#include "access/reloptions.h"#include "access/relscan.h"#include "commands/progress.h"#include "miscadmin.h"#include "utils/datum.h"#include "utils/lsyscache.h"#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
| struct | BTOneVacInfo |
| struct | BTVacInfo |
Macros | |
| #define | LOOK_AHEAD_REQUIRED_RECHECKS 3 |
| #define | LOOK_AHEAD_DEFAULT_DISTANCE 5 |
| #define | NSKIPADVANCES_THRESHOLD 3 |
Typedefs | |
| typedef struct BTOneVacInfo | BTOneVacInfo |
| typedef struct BTVacInfo | BTVacInfo |
Functions | |
| static int32 | _bt_compare_array_skey (FmgrInfo *orderproc, Datum tupdatum, bool tupnull, Datum arrdatum, ScanKey cur) |
| static void | _bt_binsrch_skiparray_skey (bool cur_elem_trig, ScanDirection dir, Datum tupdatum, bool tupnull, BTArrayKeyInfo *array, ScanKey cur, int32 *set_elem_result) |
| static void | _bt_skiparray_set_element (Relation rel, ScanKey skey, BTArrayKeyInfo *array, int32 set_elem_result, Datum tupdatum, bool tupnull) |
| static void | _bt_skiparray_set_isnull (Relation rel, ScanKey skey, BTArrayKeyInfo *array) |
| static void | _bt_array_set_low_or_high (Relation rel, ScanKey skey, BTArrayKeyInfo *array, bool low_not_high) |
| static bool | _bt_array_decrement (Relation rel, ScanKey skey, BTArrayKeyInfo *array) |
| static bool | _bt_array_increment (Relation rel, ScanKey skey, BTArrayKeyInfo *array) |
| static bool | _bt_advance_array_keys_increment (IndexScanDesc scan, ScanDirection dir, bool *skip_array_set) |
| static bool | _bt_tuple_before_array_skeys (IndexScanDesc scan, ScanDirection dir, IndexTuple tuple, TupleDesc tupdesc, int tupnatts, bool readpagetup, int sktrig, bool *scanBehind) |
| static bool | _bt_advance_array_keys (IndexScanDesc scan, BTReadPageState *pstate, IndexTuple tuple, int tupnatts, TupleDesc tupdesc, int sktrig, bool sktrig_required) |
| static bool | _bt_oppodir_checkkeys (IndexScanDesc scan, ScanDirection dir, IndexTuple finaltup) |
| static bool | _bt_check_compare (IndexScanDesc scan, ScanDirection dir, IndexTuple tuple, int tupnatts, TupleDesc tupdesc, bool advancenonrequired, bool forcenonrequired, bool *continuescan, int *ikey) |
| static bool | _bt_rowcompare_cmpresult (ScanKey subkey, int cmpresult) |
| static bool | _bt_check_rowcompare (ScanKey header, IndexTuple tuple, int tupnatts, TupleDesc tupdesc, ScanDirection dir, bool forcenonrequired, bool *continuescan) |
| static void | _bt_checkkeys_look_ahead (IndexScanDesc scan, BTReadPageState *pstate, int tupnatts, TupleDesc tupdesc) |
| static int | _bt_keep_natts (Relation rel, IndexTuple lastleft, IndexTuple firstright, BTScanInsert itup_key) |
| BTScanInsert | _bt_mkscankey (Relation rel, IndexTuple itup) |
| void | _bt_freestack (BTStack stack) |
| int | _bt_binsrch_array_skey (FmgrInfo *orderproc, bool cur_elem_trig, ScanDirection dir, Datum tupdatum, bool tupnull, BTArrayKeyInfo *array, ScanKey cur, int32 *set_elem_result) |
| void | _bt_start_array_keys (IndexScanDesc scan, ScanDirection dir) |
| bool | _bt_start_prim_scan (IndexScanDesc scan, ScanDirection dir) |
| bool | _bt_checkkeys (IndexScanDesc scan, BTReadPageState *pstate, bool arrayKeys, IndexTuple tuple, int tupnatts) |
| bool | _bt_scanbehind_checkkeys (IndexScanDesc scan, ScanDirection dir, IndexTuple finaltup) |
| void | _bt_set_startikey (IndexScanDesc scan, BTReadPageState *pstate) |
| void | _bt_killitems (IndexScanDesc scan) |
| BTCycleId | _bt_vacuum_cycleid (Relation rel) |
| BTCycleId | _bt_start_vacuum (Relation rel) |
| void | _bt_end_vacuum (Relation rel) |
| void | _bt_end_vacuum_callback (int code, Datum arg) |
| Size | BTreeShmemSize (void) |
| void | BTreeShmemInit (void) |
| bytea * | btoptions (Datum reloptions, bool validate) |
| bool | btproperty (Oid index_oid, int attno, IndexAMProperty prop, const char *propname, bool *res, bool *isnull) |
| char * | btbuildphasename (int64 phasenum) |
| IndexTuple | _bt_truncate (Relation rel, IndexTuple lastleft, IndexTuple firstright, BTScanInsert itup_key) |
| int | _bt_keep_natts_fast (Relation rel, IndexTuple lastleft, IndexTuple firstright) |
| bool | _bt_check_natts (Relation rel, bool heapkeyspace, Page page, OffsetNumber offnum) |
| void | _bt_check_third_page (Relation rel, Relation heap, bool needheaptidspace, Page page, IndexTuple newtup) |
| bool | _bt_allequalimage (Relation rel, bool debugmessage) |
Variables | |
| static BTVacInfo * | btvacinfo |
| #define LOOK_AHEAD_DEFAULT_DISTANCE 5 |
Definition at line 31 of file nbtutils.c.
| #define LOOK_AHEAD_REQUIRED_RECHECKS 3 |
Definition at line 30 of file nbtutils.c.
| #define NSKIPADVANCES_THRESHOLD 3 |
Definition at line 32 of file nbtutils.c.
| typedef struct BTOneVacInfo BTOneVacInfo |
|
static |
Definition at line 1393 of file nbtutils.c.
References _bt_advance_array_keys(), _bt_advance_array_keys_increment(), _bt_array_set_low_or_high(), _bt_binsrch_array_skey(), _bt_binsrch_skiparray_skey(), _bt_check_compare(), _bt_compare_array_skey(), _bt_oppodir_checkkeys(), _bt_parallel_primscan_schedule(), _bt_skiparray_set_element(), _bt_tuple_before_array_skeys(), BTScanOpaqueData::arrayKeys, Assert(), BTEqualStrategyNumber, BTreeTupleGetNAtts, BTReadPageState::continuescan, cur, BTArrayKeyInfo::cur_elem, BTScanPosData::currPage, BTScanOpaqueData::currPos, BTScanPosData::dir, BTArrayKeyInfo::elem_values, BTReadPageState::finaltup, BTReadPageState::firstpage, index_getattr(), IndexScanDescData::indexRelation, BTScanOpaqueData::keyData, BTReadPageState::maxoff, BTScanOpaqueData::needPrimScan, BTReadPageState::nskipadvances, NSKIPADVANCES_THRESHOLD, BTArrayKeyInfo::num_elems, BTScanOpaqueData::numberOfKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, BTScanOpaqueData::orderProcs, IndexScanDescData::parallel_scan, PG_USED_FOR_ASSERTS_ONLY, BTReadPageState::rechecks, generate_unaccent_rules::required, BTArrayKeyInfo::scan_key, BTScanOpaqueData::scanBehind, ScanDirectionIsBackward, ScanDirectionIsForward, SK_BT_REQBKWD, SK_BT_REQFWD, ScanKeyData::sk_flags, SK_SEARCHARRAY, ScanKeyData::sk_strategy, BTReadPageState::skip, BTReadPageState::targetdistance, and unlikely.
Referenced by _bt_advance_array_keys(), _bt_check_compare(), and _bt_checkkeys().
|
static |
Definition at line 977 of file nbtutils.c.
References _bt_array_decrement(), _bt_array_increment(), _bt_array_set_low_or_high(), _bt_start_array_keys(), BTScanOpaqueData::arrayKeys, for(), i, IndexScanDescData::indexRelation, BTScanOpaqueData::keyData, BTArrayKeyInfo::num_elems, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTArrayKeyInfo::scan_key, and ScanDirectionIsForward.
Referenced by _bt_advance_array_keys().
| bool _bt_allequalimage | ( | Relation | rel, |
| bool | debugmessage | ||
| ) |
Definition at line 4366 of file nbtutils.c.
References BTEQUALIMAGE_PROC, DatumGetBool(), DEBUG1, elog, get_opfamily_proc(), i, IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, ObjectIdGetDatum(), OidFunctionCall1Coll(), OidIsValid, RelationData::rd_indcollation, RelationData::rd_opcintype, RelationData::rd_opfamily, and RelationGetRelationName.
Referenced by _bt_leafbuild(), bt_index_check_callback(), and btbuildempty().
|
static |
Definition at line 705 of file nbtutils.c.
References _bt_skiparray_set_isnull(), Assert(), BTArrayKeyInfo::attbyval, BTArrayKeyInfo::attlen, BTArrayKeyInfo::cur_elem, datumCopy(), DatumGetBool(), DatumGetPointer(), SkipSupportData::decrement, BTArrayKeyInfo::elem_values, FunctionCall2Coll(), SkipSupportData::high_elem, BTArrayKeyInfo::low_compare, BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, pfree(), ScanKeyData::sk_argument, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_NULLS_FIRST, SK_BT_PRIOR, SK_BT_SKIP, ScanKeyData::sk_collation, ScanKeyData::sk_flags, ScanKeyData::sk_func, SK_ISNULL, SK_SEARCHARRAY, SK_SEARCHNULL, BTArrayKeyInfo::sksup, and unlikely.
Referenced by _bt_advance_array_keys_increment().
|
static |
Definition at line 838 of file nbtutils.c.
References _bt_skiparray_set_isnull(), Assert(), BTArrayKeyInfo::attbyval, BTArrayKeyInfo::attlen, BTArrayKeyInfo::cur_elem, datumCopy(), DatumGetBool(), DatumGetPointer(), BTArrayKeyInfo::elem_values, FunctionCall2Coll(), BTArrayKeyInfo::high_compare, SkipSupportData::increment, SkipSupportData::low_elem, BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, pfree(), ScanKeyData::sk_argument, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_NULLS_FIRST, SK_BT_PRIOR, SK_BT_SKIP, ScanKeyData::sk_collation, ScanKeyData::sk_flags, ScanKeyData::sk_func, SK_ISNULL, SK_SEARCHARRAY, SK_SEARCHNULL, BTArrayKeyInfo::sksup, and unlikely.
Referenced by _bt_advance_array_keys_increment().
|
static |
Definition at line 641 of file nbtutils.c.
References Assert(), BTArrayKeyInfo::attbyval, BTArrayKeyInfo::cur_elem, DatumGetPointer(), BTArrayKeyInfo::elem_values, BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, pfree(), ScanKeyData::sk_argument, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_NULLS_FIRST, SK_BT_PRIOR, SK_BT_SKIP, ScanKeyData::sk_flags, SK_ISNULL, SK_SEARCHARRAY, and SK_SEARCHNULL.
Referenced by _bt_advance_array_keys(), _bt_advance_array_keys_increment(), _bt_skiparray_set_element(), and _bt_start_array_keys().
| int _bt_binsrch_array_skey | ( | FmgrInfo * | orderproc, |
| bool | cur_elem_trig, | ||
| ScanDirection | dir, | ||
| Datum | tupdatum, | ||
| bool | tupnull, | ||
| BTArrayKeyInfo * | array, | ||
| ScanKey | cur, | ||
| int32 * | set_elem_result | ||
| ) |
Definition at line 289 of file nbtutils.c.
References _bt_compare_array_skey(), Assert(), BTEqualStrategyNumber, cur, BTArrayKeyInfo::cur_elem, BTArrayKeyInfo::elem_values, BTArrayKeyInfo::num_elems, ScanDirectionIsForward, ScanDirectionIsNoMovement, SK_BT_REQFWD, SK_BT_SKIP, SK_ISNULL, and SK_SEARCHARRAY.
Referenced by _bt_advance_array_keys(), _bt_saoparray_shrink(), and _bt_set_startikey().
|
static |
Definition at line 445 of file nbtutils.c.
References Assert(), cur, DatumGetBool(), FunctionCall2Coll(), BTArrayKeyInfo::high_compare, BTArrayKeyInfo::low_compare, BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, ScanDirectionIsBackward, ScanDirectionIsForward, ScanDirectionIsNoMovement, ScanKeyData::sk_argument, SK_BT_NULLS_FIRST, SK_BT_REQFWD, SK_BT_SKIP, ScanKeyData::sk_collation, ScanKeyData::sk_func, and SK_SEARCHARRAY.
Referenced by _bt_advance_array_keys(), _bt_set_startikey(), and _bt_tuple_before_array_skeys().
|
static |
Definition at line 2785 of file nbtutils.c.
References _bt_advance_array_keys(), _bt_check_rowcompare(), Assert(), BTEqualStrategyNumber, BTreeTupleIsPivot(), DatumGetBool(), for(), FunctionCall2Coll(), index_getattr(), sort-test::key, BTScanOpaqueData::keyData, BTScanOpaqueData::numberOfKeys, IndexScanDescData::opaque, ScanDirectionIsBackward, ScanDirectionIsForward, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_NULLS_FIRST, SK_BT_PRIOR, SK_BT_REQBKWD, SK_BT_REQFWD, SK_BT_SKIP, SK_ISNULL, SK_ROW_HEADER, SK_SEARCHARRAY, SK_SEARCHNOTNULL, SK_SEARCHNULL, and unlikely.
Referenced by _bt_advance_array_keys(), _bt_checkkeys(), and _bt_oppodir_checkkeys().
| bool _bt_check_natts | ( | Relation | rel, |
| bool | heapkeyspace, | ||
| Page | page, | ||
| OffsetNumber | offnum | ||
| ) |
Definition at line 4149 of file nbtutils.c.
References Assert(), BT_PIVOT_HEAP_TID_ATTR, BTPageGetOpaque, BTreeTupleGetHeapTID(), BTreeTupleGetNAtts, BTreeTupleIsPivot(), BTreeTupleIsPosting(), FirstOffsetNumber, IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, ItemPointerGetOffsetNumber(), ItemPointerGetOffsetNumberNoCheck(), P_FIRSTDATAKEY, P_HIKEY, P_IGNORE, P_ISLEAF, P_RIGHTMOST, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), and IndexTupleData::t_tid.
Referenced by _bt_compare(), and bt_target_page_check().
|
static |
Definition at line 3090 of file nbtutils.c.
References _bt_rowcompare_cmpresult(), Assert(), BTreeTupleIsPivot(), DatumGetInt32(), DatumGetPointer(), FunctionCall2Coll(), index_getattr(), INVERT_COMPARE_RESULT, ScanDirectionIsBackward, ScanDirectionIsForward, ScanKeyData::sk_argument, ScanKeyData::sk_attno, SK_BT_DESC, SK_BT_NULLS_FIRST, SK_BT_REQBKWD, SK_BT_REQFWD, ScanKeyData::sk_collation, ScanKeyData::sk_flags, ScanKeyData::sk_func, SK_ISNULL, SK_ROW_END, SK_ROW_HEADER, SK_ROW_MEMBER, and ScanKeyData::sk_strategy.
Referenced by _bt_check_compare().
| void _bt_check_third_page | ( | Relation | rel, |
| Relation | heap, | ||
| bool | needheaptidspace, | ||
| Page | page, | ||
| IndexTuple | newtup | ||
| ) |
Definition at line 4309 of file nbtutils.c.
References BTMaxItemSize, BTMaxItemSizeNoHeapTid, BTPageGetOpaque, BTREE_NOVAC_VERSION, BTREE_VERSION, BTreeTupleGetHeapTID(), elog, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, errtableconstraint(), IndexTupleSize(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), MAXALIGN, P_ISLEAF, and RelationGetRelationName.
Referenced by _bt_buildadd(), and _bt_findinsertloc().
| bool _bt_checkkeys | ( | IndexScanDesc | scan, |
| BTReadPageState * | pstate, | ||
| bool | arrayKeys, | ||
| IndexTuple | tuple, | ||
| int | tupnatts | ||
| ) |
Definition at line 2150 of file nbtutils.c.
References _bt_advance_array_keys(), _bt_check_compare(), _bt_checkkeys_look_ahead(), _bt_tuple_before_array_skeys(), Assert(), BTreeTupleGetNAtts, BTReadPageState::continuescan, BTScanOpaqueData::currPos, BTScanPosData::dir, BTReadPageState::forcenonrequired, IndexScanDescData::indexRelation, LOOK_AHEAD_REQUIRED_RECHECKS, BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, BTReadPageState::rechecks, RelationGetDescr, BTScanOpaqueData::scanBehind, and BTReadPageState::startikey.
Referenced by _bt_readpage().
|
static |
Definition at line 3301 of file nbtutils.c.
References _bt_tuple_before_array_skeys(), Assert(), BTScanOpaqueData::currPos, BTScanPosData::dir, BTReadPageState::forcenonrequired, LOOK_AHEAD_DEFAULT_DISTANCE, Max, MaxIndexTuplesPerPage, BTReadPageState::maxoff, Min, BTReadPageState::minoff, BTReadPageState::offnum, IndexScanDescData::opaque, BTReadPageState::page, PageGetItem(), PageGetItemId(), BTReadPageState::rechecks, ScanDirectionIsBackward, ScanDirectionIsForward, BTReadPageState::skip, and BTReadPageState::targetdistance.
Referenced by _bt_checkkeys().
|
inlinestatic |
Definition at line 218 of file nbtutils.c.
References Assert(), BTEqualStrategyNumber, cur, DatumGetInt32(), FunctionCall2Coll(), INVERT_COMPARE_RESULT, SK_BT_DESC, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NULLS_FIRST, and SK_ISNULL.
Referenced by _bt_advance_array_keys(), _bt_binsrch_array_skey(), and _bt_tuple_before_array_skeys().
| void _bt_end_vacuum | ( | Relation | rel | ) |
Definition at line 3711 of file nbtutils.c.
References btvacinfo, LockRelId::dbId, i, LockInfoData::lockRelId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), BTVacInfo::num_vacuums, RelationData::rd_lockInfo, BTOneVacInfo::relid, LockRelId::relId, and BTVacInfo::vacuums.
Referenced by _bt_end_vacuum_callback(), and btbulkdelete().
| void _bt_end_vacuum_callback | ( | int | code, |
| Datum | arg | ||
| ) |
Definition at line 3739 of file nbtutils.c.
References _bt_end_vacuum(), arg, and DatumGetPointer().
Referenced by btbulkdelete().
| void _bt_freestack | ( | BTStack | stack | ) |
Definition at line 189 of file nbtutils.c.
References BTStackData::bts_parent, and pfree().
Referenced by _bt_doinsert(), _bt_first(), and bt_rootdescend().
|
static |
Definition at line 4028 of file nbtutils.c.
References _bt_keep_natts_fast(), BTScanInsertData::allequalimage, Assert(), attnum, DatumGetInt32(), FunctionCall2Coll(), BTScanInsertData::heapkeyspace, index_getattr(), IndexRelationGetNumberOfKeyAttributes, RelationGetDescr, BTScanInsertData::scankeys, ScanKeyData::sk_collation, and ScanKeyData::sk_func.
Referenced by _bt_truncate().
| int _bt_keep_natts_fast | ( | Relation | rel, |
| IndexTuple | lastleft, | ||
| IndexTuple | firstright | ||
| ) |
Definition at line 4102 of file nbtutils.c.
References CompactAttribute::attbyval, CompactAttribute::attlen, attnum, datum_image_eq(), index_getattr(), IndexRelationGetNumberOfKeyAttributes, RelationGetDescr, and TupleDescCompactAttr().
Referenced by _bt_afternewitemoff(), _bt_bottomupdel_pass(), _bt_dedup_pass(), _bt_do_singleval(), _bt_keep_natts(), _bt_load(), _bt_set_startikey(), _bt_split_penalty(), and _bt_strategy().
| void _bt_killitems | ( | IndexScanDesc | scan | ) |
Definition at line 3401 of file nbtutils.c.
References _bt_getbuf(), _bt_lockbuf(), _bt_relbuf(), _bt_unlockbuf(), Assert(), BT_READ, BTP_HAS_GARBAGE, BTPageGetOpaque, BTreeTupleGetNPosting(), BTreeTupleGetPostingN(), BTreeTupleIsPosting(), BTScanPosIsPinned, BTScanPosIsValid, buf, BTScanPosData::buf, BufferGetLSNAtomic(), BufferGetPage(), BTScanPosData::currPage, BTScanOpaqueData::currPos, BTScanOpaqueData::dropPin, BTScanPosData::firstItem, IndexScanDescData::heapRelation, BTScanPosItem::heapTid, i, BTScanPosItem::indexOffset, IndexScanDescData::indexRelation, ItemIdIsDead, ItemIdMarkDead, ItemPointerEquals(), BTScanPosData::items, j, BTScanOpaqueData::killedItems, BTScanPosData::lsn, MarkBufferDirtyHint(), BTScanOpaqueData::numKilled, OffsetNumberNext, IndexScanDescData::opaque, P_FIRSTDATAKEY, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), RelationNeedsWAL, and IndexTupleData::t_tid.
Referenced by _bt_steppage(), btendscan(), btrescan(), and btrestrpos().
| BTScanInsert _bt_mkscankey | ( | Relation | rel, |
| IndexTuple | itup | ||
| ) |
Definition at line 97 of file nbtutils.c.
References _bt_metaversion(), arg, Assert(), BTORDER_PROC, BTreeTupleGetHeapTID(), BTreeTupleGetNAtts, i, index_getattr(), index_getprocinfo(), IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, InvalidOid, InvalidStrategy, sort-test::key, Min, palloc(), RelationData::rd_indcollation, RelationData::rd_index, RelationData::rd_indoption, RelationGetDescr, ScanKeyEntryInitializeWithInfo(), SK_BT_INDOPTION_SHIFT, and SK_ISNULL.
Referenced by _bt_doinsert(), _bt_leafbuild(), _bt_pagedel(), bt_mkscankey_pivotsearch(), bt_rootdescend(), tuplesort_begin_cluster(), and tuplesort_begin_index_btree().
|
static |
Definition at line 2333 of file nbtutils.c.
References _bt_check_compare(), Assert(), BTEqualStrategyNumber, BTreeTupleGetNAtts, IndexScanDescData::indexRelation, BTScanOpaqueData::keyData, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, RelationGetDescr, and ScanKeyData::sk_strategy.
Referenced by _bt_advance_array_keys(), and _bt_scanbehind_checkkeys().
|
static |
Definition at line 3007 of file nbtutils.c.
References Assert(), BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, elog, ERROR, ScanKeyData::sk_flags, SK_ROW_MEMBER, and ScanKeyData::sk_strategy.
Referenced by _bt_check_rowcompare(), and _bt_set_startikey().
| bool _bt_scanbehind_checkkeys | ( | IndexScanDesc | scan, |
| ScanDirection | dir, | ||
| IndexTuple | finaltup | ||
| ) |
Definition at line 2278 of file nbtutils.c.
References _bt_oppodir_checkkeys(), _bt_tuple_before_array_skeys(), Assert(), BTreeTupleGetNAtts, IndexScanDescData::indexRelation, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, and RelationGetDescr.
Referenced by _bt_readpage().
| void _bt_set_startikey | ( | IndexScanDesc | scan, |
| BTReadPageState * | pstate | ||
| ) |
Definition at line 2391 of file nbtutils.c.
References _bt_binsrch_array_skey(), _bt_binsrch_skiparray_skey(), _bt_keep_natts_fast(), _bt_rowcompare_cmpresult(), BTScanOpaqueData::arrayKeys, Assert(), BTEqualStrategyNumber, BTPageGetOpaque, DatumGetBool(), DatumGetInt32(), DatumGetPointer(), BTReadPageState::finaltup, BTReadPageState::firstpage, BTReadPageState::forcenonrequired, ForwardScanDirection, FunctionCall2Coll(), index_getattr(), IndexScanDescData::indexRelation, INVERT_COMPARE_RESULT, sort-test::key, BTScanOpaqueData::keyData, BTReadPageState::maxoff, BTReadPageState::minoff, NoMovementScanDirection, BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, BTScanOpaqueData::numArrayKeys, BTScanOpaqueData::numberOfKeys, IndexScanDescData::opaque, BTScanOpaqueData::orderProcs, P_LEFTMOST, P_RIGHTMOST, BTReadPageState::page, PageGetItem(), PageGetItemId(), RelationGetDescr, BTArrayKeyInfo::scan_key, BTScanOpaqueData::scanBehind, ScanKeyData::sk_argument, ScanKeyData::sk_attno, SK_BT_DESC, SK_BT_SKIP, ScanKeyData::sk_collation, ScanKeyData::sk_flags, ScanKeyData::sk_func, SK_ISNULL, SK_ROW_END, SK_ROW_HEADER, SK_SEARCHARRAY, SK_SEARCHNOTNULL, SK_SEARCHNULL, BTScanOpaqueData::skipScan, and BTReadPageState::startikey.
Referenced by _bt_readpage().
|
static |
Definition at line 552 of file nbtutils.c.
References _bt_array_set_low_or_high(), _bt_skiparray_set_isnull(), Assert(), BTArrayKeyInfo::attbyval, BTArrayKeyInfo::attlen, datumCopy(), DatumGetPointer(), BTArrayKeyInfo::null_elem, pfree(), ScanKeyData::sk_argument, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_PRIOR, SK_BT_SKIP, ScanKeyData::sk_flags, SK_ISNULL, SK_SEARCHARRAY, SK_SEARCHNULL, and unlikely.
Referenced by _bt_advance_array_keys().
|
static |
Definition at line 589 of file nbtutils.c.
References Assert(), BTArrayKeyInfo::attbyval, DatumGetPointer(), BTArrayKeyInfo::high_compare, BTArrayKeyInfo::low_compare, BTArrayKeyInfo::null_elem, pfree(), ScanKeyData::sk_argument, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_PRIOR, SK_BT_SKIP, ScanKeyData::sk_flags, SK_ISNULL, SK_SEARCHARRAY, and SK_SEARCHNULL.
Referenced by _bt_array_decrement(), _bt_array_increment(), and _bt_skiparray_set_element().
| void _bt_start_array_keys | ( | IndexScanDesc | scan, |
| ScanDirection | dir | ||
| ) |
Definition at line 613 of file nbtutils.c.
References _bt_array_set_low_or_high(), BTScanOpaqueData::arrayKeys, Assert(), i, IndexScanDescData::indexRelation, BTScanOpaqueData::keyData, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, BTScanOpaqueData::qual_ok, BTArrayKeyInfo::scan_key, BTScanOpaqueData::scanBehind, ScanDirectionIsForward, ScanKeyData::sk_flags, and SK_SEARCHARRAY.
Referenced by _bt_advance_array_keys_increment(), _bt_first(), _bt_readpage(), and btrestrpos().
| bool _bt_start_prim_scan | ( | IndexScanDesc | scan, |
| ScanDirection | dir | ||
| ) |
Definition at line 1274 of file nbtutils.c.
References _bt_parallel_done(), Assert(), BTScanOpaqueData::needPrimScan, BTScanOpaqueData::numArrayKeys, IndexScanDescData::opaque, BTScanOpaqueData::oppositeDirCheck, IndexScanDescData::parallel_scan, and BTScanOpaqueData::scanBehind.
Referenced by btgetbitmap(), and btgettuple().
Definition at line 3654 of file nbtutils.c.
References btvacinfo, BTVacInfo::cycle_ctr, BTOneVacInfo::cycleid, LockRelId::dbId, elog, ERROR, i, LockInfoData::lockRelId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_BT_CYCLE_ID, BTVacInfo::max_vacuums, BTVacInfo::num_vacuums, RelationData::rd_lockInfo, RelationGetRelationName, BTOneVacInfo::relid, LockRelId::relId, and BTVacInfo::vacuums.
Referenced by btbulkdelete().
| IndexTuple _bt_truncate | ( | Relation | rel, |
| IndexTuple | lastleft, | ||
| IndexTuple | firstright, | ||
| BTScanInsert | itup_key | ||
| ) |
Definition at line 3883 of file nbtutils.c.
References _bt_keep_natts(), Assert(), BTreeTupleGetHeapTID(), BTreeTupleGetMaxHeapTID(), BTreeTupleGetPostingOffset(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), BTreeTupleSetNAtts(), index_truncate_tuple(), IndexRelationGetNumberOfAttributes, IndexRelationGetNumberOfKeyAttributes, IndexTupleSize(), ItemPointerCompare(), ItemPointerCopy(), ItemPointerGetOffsetNumber(), ItemPointerSetOffsetNumber(), MAXALIGN, Min, OffsetNumberPrev, palloc0(), pfree(), RelationGetDescr, and IndexTupleData::t_info.
Referenced by _bt_buildadd(), and _bt_split().
|
static |
Definition at line 1082 of file nbtutils.c.
References _bt_binsrch_skiparray_skey(), _bt_compare_array_skey(), BTScanOpaqueData::arrayKeys, Assert(), BTEqualStrategyNumber, cur, index_getattr(), BTScanOpaqueData::keyData, likely, BTScanOpaqueData::numArrayKeys, BTScanOpaqueData::numberOfKeys, IndexScanDescData::opaque, BTScanOpaqueData::orderProcs, BTArrayKeyInfo::scan_key, ScanDirectionIsBackward, ScanDirectionIsForward, SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_PRIOR, SK_BT_REQBKWD, SK_BT_REQFWD, and SK_BT_SKIP.
Referenced by _bt_advance_array_keys(), _bt_checkkeys(), _bt_checkkeys_look_ahead(), and _bt_scanbehind_checkkeys().
Definition at line 3620 of file nbtutils.c.
References btvacinfo, BTOneVacInfo::cycleid, LockRelId::dbId, i, LockInfoData::lockRelId, LW_SHARED, LWLockAcquire(), LWLockRelease(), BTVacInfo::num_vacuums, RelationData::rd_lockInfo, BTOneVacInfo::relid, LockRelId::relId, and BTVacInfo::vacuums.
Referenced by _bt_split().
| char * btbuildphasename | ( | int64 | phasenum | ) |
Definition at line 3835 of file nbtutils.c.
References PROGRESS_BTREE_PHASE_INDEXBUILD_TABLESCAN, PROGRESS_BTREE_PHASE_LEAF_LOAD, PROGRESS_BTREE_PHASE_PERFORMSORT_1, PROGRESS_BTREE_PHASE_PERFORMSORT_2, and PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE.
Referenced by bthandler().
Definition at line 3789 of file nbtutils.c.
References build_reloptions(), fillfactor, lengthof, RELOPT_KIND_BTREE, RELOPT_TYPE_BOOL, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, and validate().
Referenced by bthandler().
| bool btproperty | ( | Oid | index_oid, |
| int | attno, | ||
| IndexAMProperty | prop, | ||
| const char * | propname, | ||
| bool * | res, | ||
| bool * | isnull | ||
| ) |
Definition at line 3812 of file nbtutils.c.
References AMPROP_RETURNABLE.
Referenced by bthandler().
| void BTreeShmemInit | ( | void | ) |
Definition at line 3761 of file nbtutils.c.
References Assert(), BTreeShmemSize(), btvacinfo, BTVacInfo::cycle_ctr, IsUnderPostmaster, BTVacInfo::max_vacuums, MaxBackends, BTVacInfo::num_vacuums, and ShmemInitStruct().
Referenced by CreateOrAttachShmemStructs().
| Size BTreeShmemSize | ( | void | ) |
Definition at line 3748 of file nbtutils.c.
References add_size(), MaxBackends, and mul_size().
Referenced by BTreeShmemInit(), and CalculateShmemSize().
|
static |
Definition at line 3607 of file nbtutils.c.
Referenced by _bt_end_vacuum(), _bt_start_vacuum(), _bt_vacuum_cycleid(), and BTreeShmemInit().