From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, vdavydov.dev@gmail.com
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [PATCH v3 0/7] box: introduce hint option for memtx tree index
Date: Fri, 22 Feb 2019 18:42:25 +0300 [thread overview]
Message-ID: <cover.1550849496.git.kshcherbatov@tarantool.org> (raw)
Reworked memtx tree to use 'tuple hints'.
Introduced special functions for retrieve tuple hints for a particular key_def.
Hint is an integer that can be used for tuple comparison optimization:
if a hint of one tuple is less than a hint of another then the first
tuple is definitely less than the second; only if hints are equal
tuple_compare must be called for getting comparison result.
Hints are only useful when:
* they are precalculated and stored along with the tuple;
calculation is not cheap (cheaper than tuple_compare btw) but
precalculated hints allow to compare tuples without even fetching
tuple data.
* first part of key_def is 'string', 'unsigned' or 'integer'
* since hint is calculated using only the first part of key_def
(and only first several characters if it is a string) this part
must be different with high probability for every tuple pair.
Enabled hint option improve performance on average by 15%; Select operations
are significantly accelerated (there are scenarios in which the difference
reaches 200-250%).
Changes in version 3:
-- Better-structured code
-- Refactored all memtx indexes to use shared mempool of default size
-- Refactored all memtx indexes to hide implementation details from headers
-- Moved all hints-related code to corresponding module
-- Better types names, better comments
-- Fixed potential bug with iterators: introduce MEMTX_TREE_IDENTICAL macro
-- Fix inaccurate MEMTX_TREE_ELEM_SET usage in memtx_tree_index_build_next
-- Changed approach to calculate string hints
-- Introduce separate hint for binary collation type
Changes in version 2:
-- Splitted patch to parts in other way to decrease diff
-- Hints are not index option anymore, but default where possible
-- Removed hints for numeric types
v2: https://www.freelists.org/post/tarantool-patches/PATCH-v2-04-box-introduce-hint-option-for-memtx-tree-index
Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-3961-tuple-hints
Issue: https://github.com/tarantool/tarantool/issues/3961
Alexandr Lyapunov (1):
memtx: introduce tuple compare hint
Kirill Shcherbatov (6):
memtx: introduce universal iterator_pool
lib: fix undef _api_name in bps_tree header
lib: introduce BPS_TREE_IDENTICAL custom comparator
memtx: hide index implementation details from header
memtx: rework memtx_tree to store arbitrary nodes
memtx: rename memtx_tree.c to memtx_tree_impl.h
src/box/CMakeLists.txt | 3 +-
src/box/key_def.c | 2 +
src/box/key_def.h | 44 ++
src/box/memtx_bitset.c | 33 +-
src/box/memtx_bitset.h | 26 +-
src/box/memtx_engine.c | 10 +-
src/box/memtx_engine.h | 17 +-
src/box/memtx_hash.c | 58 ++-
src/box/memtx_hash.h | 44 +-
src/box/memtx_rtree.c | 26 +-
src/box/memtx_rtree.h | 16 +-
src/box/memtx_space.c | 16 +-
src/box/memtx_tree.h | 68 +--
src/box/memtx_tree_decl.c | 173 +++++++
src/box/{memtx_tree.c => memtx_tree_impl.h} | 531 ++++++++++++++++----
src/box/tuple_hint.cc | 210 ++++++++
src/box/tuple_hint.h | 51 ++
src/coll.c | 33 ++
src/coll.h | 4 +
src/lib/salad/bps_tree.h | 83 ++-
test/unit/bps_tree_iterator.cc | 16 +-
21 files changed, 1134 insertions(+), 330 deletions(-)
create mode 100644 src/box/memtx_tree_decl.c
rename src/box/{memtx_tree.c => memtx_tree_impl.h} (52%)
create mode 100644 src/box/tuple_hint.cc
create mode 100644 src/box/tuple_hint.h
--
2.20.1
next reply other threads:[~2019-02-22 15:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 15:42 Kirill Shcherbatov [this message]
2019-02-22 15:42 ` [PATCH v3 1/7] memtx: introduce universal iterator_pool Kirill Shcherbatov
2019-02-22 18:37 ` [tarantool-patches] " Konstantin Osipov
2019-02-23 12:03 ` Kirill Shcherbatov
2019-02-25 16:14 ` Vladimir Davydov
2019-02-25 16:39 ` [tarantool-patches] " Kirill Shcherbatov
2019-02-25 17:14 ` Vladimir Davydov
2019-02-24 6:56 ` [tarantool-patches] " Vladimir Davydov
2019-02-24 17:15 ` Konstantin Osipov
2019-02-24 18:22 ` Vladimir Davydov
2019-02-25 16:46 ` [tarantool-patches] " Konstantin Osipov
2019-02-25 17:15 ` Vladimir Davydov
2019-02-22 15:42 ` [PATCH v3 2/7] lib: fix undef _api_name in bps_tree header Kirill Shcherbatov
2019-02-22 18:37 ` [tarantool-patches] " Konstantin Osipov
2019-02-25 15:32 ` Vladimir Davydov
2019-02-22 15:42 ` [PATCH v3 3/7] lib: introduce BPS_TREE_IDENTICAL custom comparator Kirill Shcherbatov
2019-02-25 15:33 ` Vladimir Davydov
2019-02-22 15:42 ` [PATCH v3 4/7] memtx: hide index implementation details from header Kirill Shcherbatov
2019-02-22 18:40 ` [tarantool-patches] " Konstantin Osipov
2019-02-25 15:33 ` Vladimir Davydov
2019-02-22 15:42 ` [PATCH v3 5/7] memtx: rework memtx_tree to store arbitrary nodes Kirill Shcherbatov
2019-02-25 16:57 ` Vladimir Davydov
2019-02-26 12:10 ` [tarantool-patches] " Kirill Shcherbatov
2019-02-22 15:42 ` [PATCH v3 6/7] memtx: rename memtx_tree.c to memtx_tree_impl.h Kirill Shcherbatov
2019-02-22 15:42 ` [PATCH v3 7/7] memtx: introduce tuple compare hint Kirill Shcherbatov
2019-02-25 17:44 ` Vladimir Davydov
2019-02-26 12:10 ` [tarantool-patches] " Kirill Shcherbatov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1550849496.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [PATCH v3 0/7] box: introduce hint option for memtx tree index' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox