MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / fast_load

Function fast_load

src/jrd/btr.cpp:3745–4525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3743
3744
3745static ULONG fast_load(thread_db* tdbb,
3746 IndexCreation& creation,
3747 SelectivityList& selectivity)
3748{
3749/**************************************
3750 *
3751 * f a s t _ l o a d
3752 *
3753 **************************************
3754 *
3755 * Functional description
3756 * Do a fast load. The indices have already been passed into sort, and
3757 * are ripe for the plucking. This beast is complicated, but, I hope,
3758 * comprehendable.
3759 *
3760 **************************************/
3761#ifdef DEBUG_BTR_PAGES
3762 TEXT debugtext[1024];
3763#endif
3764
3765 SET_TDBB(tdbb);
3766 const Database* const dbb = tdbb->getDatabase();
3767 CHECK_DBB(dbb);
3768
3769 jrd_rel* const relation = creation.relation;
3770 index_desc* const idx = creation.index;
3771 const USHORT key_length = creation.key_length;
3772
3773 const USHORT pageSpaceID = relation->getPages(tdbb)->rel_pg_space_id;
3774
3775 // leaf-page and pointer-page size limits, we always need to
3776 // leave room for the END_LEVEL node.
3777 const USHORT lp_fill_limit = dbb->dbb_page_size - BTN_LEAF_SIZE;
3778 const USHORT pp_fill_limit = dbb->dbb_page_size - BTN_PAGE_SIZE;
3779
3780 // AB: Let's try to determine to size between the jumps to speed up
3781 // index search. Of course the size depends on the key_length. The
3782 // bigger the key, the less jumps we can make. (Although we must
3783 // not forget that mostly the keys are compressed and much smaller
3784 // than the maximum possible key!).
3785 // These values can easily change without effect on previous created
3786 // indices, cause this value is stored on each page.
3787 // Remember, the lower the value how more jumpkeys are generated and
3788 // how faster jumpkeys are recalculated on insert.
3789
3790 const USHORT jumpAreaSize = 512 + ((int) sqrt((float) key_length) * 16);
3791
3792 // key_size | jumpAreaSize
3793 // ----------+-----------------
3794 // 4 | 544
3795 // 8 | 557
3796 // 16 | 576
3797 // 64 | 640
3798 // 128 | 693
3799 // 256 | 768
3800
3801 WIN* window = NULL;
3802 bool error = false;

Callers 1

BTR_createFunction · 0.85

Calls 15

SET_TDBBFunction · 0.85
CHECK_DBBFunction · 0.85
RecordNumberClass · 0.85
CCH_RELEASEFunction · 0.85
raiseFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
JRD_rescheduleFunction · 0.85
ERR_puntFunction · 0.85
CCH_flushFunction · 0.85
delete_treeFunction · 0.85
getDatabaseMethod · 0.80

Tested by

no test coverage detected