|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/nbtree.h"#include "access/relscan.h"#include "storage/predicate.h"#include "utils/datum.h"#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
| struct | BTReadPageState |
Macros | |
| #define | LOOK_AHEAD_REQUIRED_RECHECKS 3 |
| #define | LOOK_AHEAD_DEFAULT_DISTANCE 5 |
| #define | NSKIPADVANCES_THRESHOLD 3 |
Typedefs | |
| typedef struct BTReadPageState | BTReadPageState |
| #define LOOK_AHEAD_DEFAULT_DISTANCE 5 |
Definition at line 1117 of file nbtreadpage.c.
| #define LOOK_AHEAD_REQUIRED_RECHECKS 3 |
Definition at line 1116 of file nbtreadpage.c.
| #define NSKIPADVANCES_THRESHOLD 3 |
Definition at line 1118 of file nbtreadpage.c.
|
static |
Definition at line 2182 of file nbtreadpage.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(), Assert, BTEqualStrategyNumber, BTreeTupleGetNAtts, BTReadPageState::continuescan, cur, BTArrayKeyInfo::cur_elem, BTReadPageState::dir, BTArrayKeyInfo::elem_values, fb(), BTReadPageState::finaltup, BTReadPageState::firstpage, ForwardScanDirection, index_getattr(), IndexScanDescData::indexRelation, BTReadPageState::maxoff, BTReadPageState::nskipadvances, NSKIPADVANCES_THRESHOLD, BTArrayKeyInfo::num_elems, IndexScanDescData::opaque, IndexScanDescData::parallel_scan, PG_USED_FOR_ASSERTS_ONLY, BTReadPageState::rechecks, BTArrayKeyInfo::scan_key, ScanDirectionIsBackward, ScanDirectionIsForward, SK_BT_REQBKWD, SK_BT_REQFWD, SK_SEARCHARRAY, BTReadPageState::skip, BTReadPageState::targetdistance, and unlikely.
Referenced by _bt_advance_array_keys(), _bt_check_compare(), and _bt_checkkeys().
|
static |
Definition at line 2868 of file nbtreadpage.c.
References _bt_array_decrement(), _bt_array_increment(), _bt_array_set_low_or_high(), _bt_start_array_keys(), fb(), i, IndexScanDescData::indexRelation, BTArrayKeyInfo::num_elems, IndexScanDescData::opaque, BTArrayKeyInfo::scan_key, and ScanDirectionIsForward.
Referenced by _bt_advance_array_keys().
|
static |
Definition at line 3070 of file nbtreadpage.c.
References _bt_skiparray_set_isnull(), Assert, BTArrayKeyInfo::attbyval, BTArrayKeyInfo::attlen, BTArrayKeyInfo::cur_elem, datumCopy(), DatumGetBool(), DatumGetPointer(), SkipSupportData::decrement, BTArrayKeyInfo::elem_values, fb(), 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_func, SK_ISNULL, SK_SEARCHARRAY, SK_SEARCHNULL, BTArrayKeyInfo::sksup, and unlikely.
Referenced by _bt_advance_array_keys_increment().
|
static |
Definition at line 2937 of file nbtreadpage.c.
References _bt_skiparray_set_isnull(), Assert, BTArrayKeyInfo::attbyval, BTArrayKeyInfo::attlen, BTArrayKeyInfo::cur_elem, datumCopy(), DatumGetBool(), DatumGetPointer(), BTArrayKeyInfo::elem_values, fb(), 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_func, SK_ISNULL, SK_SEARCHARRAY, SK_SEARCHNULL, BTArrayKeyInfo::sksup, and unlikely.
Referenced by _bt_advance_array_keys_increment().
|
static |
Definition at line 3203 of file nbtreadpage.c.
References Assert, BTArrayKeyInfo::attbyval, BTArrayKeyInfo::cur_elem, DatumGetPointer(), BTArrayKeyInfo::elem_values, fb(), BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, pfree(), SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_NULLS_FIRST, SK_BT_PRIOR, SK_BT_SKIP, 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 3415 of file nbtreadpage.c.
References _bt_compare_array_skey(), Assert, BTEqualStrategyNumber, cur, BTArrayKeyInfo::cur_elem, BTArrayKeyInfo::elem_values, fb(), 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 3571 of file nbtreadpage.c.
References Assert, cur, DatumGetBool(), fb(), 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 1312 of file nbtreadpage.c.
References _bt_advance_array_keys(), _bt_check_rowcompare(), Assert, BTEqualStrategyNumber, BTreeTupleIsPivot(), DatumGetBool(), fb(), FunctionCall2Coll(), index_getattr(), 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().
|
static |
Definition at line 1579 of file nbtreadpage.c.
References _bt_rowcompare_cmpresult(), Assert, BTreeTupleIsPivot(), DatumGetInt32(), DatumGetPointer(), fb(), 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_flags, SK_ISNULL, SK_ROW_END, SK_ROW_HEADER, SK_ROW_MEMBER, and ScanKeyData::sk_strategy.
Referenced by _bt_check_compare().
|
static |
Definition at line 1149 of file nbtreadpage.c.
References _bt_advance_array_keys(), _bt_check_compare(), _bt_checkkeys_look_ahead(), _bt_tuple_before_array_skeys(), Assert, BTreeTupleGetNAtts, BTReadPageState::continuescan, BTReadPageState::dir, fb(), BTReadPageState::forcenonrequired, IndexScanDescData::indexRelation, LOOK_AHEAD_REQUIRED_RECHECKS, IndexScanDescData::opaque, PG_USED_FOR_ASSERTS_ONLY, BTReadPageState::rechecks, RelationGetDescr, and BTReadPageState::startikey.
Referenced by _bt_readpage().
|
static |
Definition at line 2052 of file nbtreadpage.c.
References _bt_tuple_before_array_skeys(), Assert, BTReadPageState::dir, fb(), BTReadPageState::forcenonrequired, LOOK_AHEAD_DEFAULT_DISTANCE, Max, MaxIndexTuplesPerPage, BTReadPageState::maxoff, Min, BTReadPageState::minoff, BTReadPageState::offnum, BTReadPageState::page, PageGetItem(), PageGetItemId(), BTReadPageState::rechecks, ScanDirectionIsBackward, ScanDirectionIsForward, BTReadPageState::skip, and BTReadPageState::targetdistance.
Referenced by _bt_checkkeys().
|
inlinestatic |
Definition at line 3344 of file nbtreadpage.c.
References Assert, BTEqualStrategyNumber, cur, DatumGetInt32(), fb(), 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().
|
static |
Definition at line 1007 of file nbtreadpage.c.
References _bt_check_compare(), Assert, BTEqualStrategyNumber, BTreeTupleGetNAtts, fb(), IndexScanDescData::indexRelation, IndexScanDescData::opaque, and RelationGetDescr.
Referenced by _bt_advance_array_keys(), and _bt_scanbehind_checkkeys().
| bool _bt_readpage | ( | IndexScanDesc | scan, |
| ScanDirection | dir, | ||
| OffsetNumber | offnum, | ||
| bool | firstpage | ||
| ) |
Definition at line 134 of file nbtreadpage.c.
References _bt_checkkeys(), _bt_parallel_primscan_schedule(), _bt_parallel_release(), _bt_saveitem(), _bt_savepostingitem(), _bt_scanbehind_checkkeys(), _bt_set_startikey(), _bt_setuppostingitems(), _bt_start_array_keys(), Assert, BTPageGetOpaque, BTPageOpaqueData::btpo_next, BTPageOpaqueData::btpo_prev, BTreeTupleGetNAtts, BTreeTupleGetNPosting(), BTreeTupleGetPostingN(), BTreeTupleIsPivot(), BTreeTupleIsPosting(), BTScanPosIsPinned, BufferGetBlockNumber(), BufferGetPage(), BTReadPageState::continuescan, BTReadPageState::dir, fb(), BTReadPageState::finaltup, BTReadPageState::firstpage, BTReadPageState::forcenonrequired, i, IndexScanDescData::ignore_killed_tuples, IndexScanDescData::indexRelation, IndexRelationGetNumberOfAttributes, InvalidOffsetNumber, ItemIdIsDead, Max, BTReadPageState::maxoff, MaxTIDsPerBTreePage, Min, BTReadPageState::minoff, nitems, BTReadPageState::nskipadvances, BTReadPageState::offnum, OffsetNumberIsValid, OffsetNumberNext, OffsetNumberPrev, IndexScanDescData::opaque, P_FIRSTDATAKEY, P_HIKEY, P_IGNORE, P_LEFTMOST, P_RIGHTMOST, BTReadPageState::page, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), IndexScanDescData::parallel_scan, PredicateLockPage(), BTReadPageState::rechecks, ScanDirectionIsForward, BTReadPageState::skip, BTReadPageState::startikey, BTReadPageState::targetdistance, unlikely, and IndexScanDescData::xs_snapshot.
Referenced by _bt_readfirstpage(), and _bt_readnextpage().
Definition at line 1781 of file nbtreadpage.c.
References Assert, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, elog, ERROR, fb(), and SK_ROW_MEMBER.
Referenced by _bt_check_rowcompare(), and _bt_set_startikey().
|
static |
Definition at line 1032 of file nbtreadpage.c.
References Assert, BTreeTupleIsPivot(), BTreeTupleIsPosting(), fb(), IndexTupleSize(), MAXALIGN, and IndexTupleData::t_tid.
Referenced by _bt_readpage().
|
inlinestatic |
Definition at line 1100 of file nbtreadpage.c.
References fb(), and BTScanPosItem::heapTid.
Referenced by _bt_readpage().
|
static |
Definition at line 952 of file nbtreadpage.c.
References _bt_oppodir_checkkeys(), _bt_tuple_before_array_skeys(), Assert, BTreeTupleGetNAtts, fb(), IndexScanDescData::indexRelation, IndexScanDescData::opaque, and RelationGetDescr.
Referenced by _bt_readpage().
|
static |
Definition at line 593 of file nbtreadpage.c.
References _bt_binsrch_array_skey(), _bt_binsrch_skiparray_skey(), _bt_keep_natts_fast(), _bt_rowcompare_cmpresult(), Assert, BTEqualStrategyNumber, BTPageGetOpaque, DatumGetBool(), DatumGetInt32(), DatumGetPointer(), fb(), BTReadPageState::finaltup, BTReadPageState::firstpage, BTReadPageState::forcenonrequired, ForwardScanDirection, FunctionCall2Coll(), index_getattr(), IndexScanDescData::indexRelation, INVERT_COMPARE_RESULT, BTReadPageState::maxoff, BTReadPageState::minoff, NoMovementScanDirection, BTArrayKeyInfo::null_elem, BTArrayKeyInfo::num_elems, IndexScanDescData::opaque, P_LEFTMOST, P_RIGHTMOST, BTReadPageState::page, PageGetItem(), PageGetItemId(), RelationGetDescr, BTArrayKeyInfo::scan_key, SK_BT_DESC, SK_BT_SKIP, SK_ISNULL, SK_ROW_END, SK_ROW_HEADER, SK_SEARCHARRAY, SK_SEARCHNOTNULL, SK_SEARCHNULL, and BTReadPageState::startikey.
Referenced by _bt_readpage().
|
static |
Definition at line 1062 of file nbtreadpage.c.
References Assert, BTreeTupleGetPostingOffset(), BTreeTupleIsPosting(), fb(), MAXALIGN, and IndexTupleData::t_info.
Referenced by _bt_readpage().
|
static |
Definition at line 3273 of file nbtreadpage.c.
References _bt_array_set_low_or_high(), _bt_skiparray_set_isnull(), Assert, BTArrayKeyInfo::attbyval, BTArrayKeyInfo::attlen, datumCopy(), DatumGetPointer(), fb(), BTArrayKeyInfo::null_elem, pfree(), SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_PRIOR, SK_BT_SKIP, SK_ISNULL, SK_SEARCHARRAY, SK_SEARCHNULL, and unlikely.
Referenced by _bt_advance_array_keys().
|
static |
Definition at line 3310 of file nbtreadpage.c.
References Assert, BTArrayKeyInfo::attbyval, DatumGetPointer(), fb(), BTArrayKeyInfo::high_compare, BTArrayKeyInfo::low_compare, BTArrayKeyInfo::null_elem, pfree(), SK_BT_MAXVAL, SK_BT_MINVAL, SK_BT_NEXT, SK_BT_PRIOR, SK_BT_SKIP, 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 537 of file nbtreadpage.c.
References _bt_array_set_low_or_high(), Assert, fb(), i, IndexScanDescData::indexRelation, IndexScanDescData::opaque, BTArrayKeyInfo::scan_key, ScanDirectionIsForward, and SK_SEARCHARRAY.
Referenced by _bt_advance_array_keys_increment(), _bt_first(), _bt_readpage(), and btrestrpos().
|
static |
Definition at line 1854 of file nbtreadpage.c.
References _bt_binsrch_skiparray_skey(), _bt_compare_array_skey(), Assert, BTEqualStrategyNumber, cur, fb(), index_getattr(), likely, IndexScanDescData::opaque, 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().