COLIN:一种具有高读写性能的缓存感知的动态学习索引
COLIN: A Cache-Conscious Dynamic Learned Index with High Read/Write Performance
-
摘要: 1、研究背景
与传统的B+树索引相比,学习索引具有更高的查询性能和空间效率。但是,初版学习索引既不支持插入,也不具有有界的查询复杂度。学习索引的一些变体,如FITing-Tree和PGM-index,使用了异地插入策略和自底向上的构建策略,它们支持插入操作并具有有界的查询复杂度。但是,这些策略带来了额外的查询成本,并在写密集型负载下会导致频繁的节点分裂,这些因素限制了它们的读写性能。此外,现有的学习索引都不是缓存友好的。为了获得节点上数据的位置,它们需要执行一个局部搜索,搜索范围是模型的最大误差,这将导致访问多个cacheline。
2、目的
本文的研究目标是设计一种全新的学习索引结构,该结构具有以下特点:(1)能够支持插入、删除、更新、点查询、范围查询和批量构建操作;(2)具有有界的查询复杂度;(3)能够充分利用现代CPU的缓存架构,具有较低的局部搜索代价。
3、方法
在本文中,我们提出了一种缓存感知的学习索引COLIN。与使用异地插入策略的方案不同,COLIN采用就地插入策略。它在节点中预留一些空槽位,并利用这些空槽位优化节点的数据布局。通过使用基于模型的数据放置策略和缓存感知的数据布局,我们将节点内的局部搜索和数据移动范围与模型的最大误差解耦。所以,COLIN兼具学习索引大节点、扁平化的结构与较高的缓存效率。在此基础上,我们提出了一种包含学习节点和简单节点的异构索引结构,使用简单节点来处理界外插入与数据溢出。此外,我们还详细介绍了索引的操作算法。
4、结果
我们从理论上分析了COLIN的可行性,包括它的模型最大误差和查询代价。我们在5种工作负载和3个数据集上进行了大量的实验。结果表明,与传统的B+树以及FITing-Tree、PGM-index和ALEX这3种最先进的动态学习索引相比,COLIN具有更好的读写性能。
5、结论
针对现有动态学习索引插入性能差、缓存效率低的问题,提出了缓存感知的动态学习索引COLIN。提出了缓存感知的数据布局与基于模型的数据放置策略,将节点内的局部搜索和数据移动范围与模型最大误差解耦,提高索引缓存效率的同时保持索引的扁平结构。提出在学习索引中混合使用学习节点与简单节点,使用简单节点来处理界外插入与数据溢出。实验结果和理论分析表明,COLIN不仅支持高效的查询和插入,而且具有有界的查询复杂度。Abstract: The recently proposed learned index has higher query performance and space efficiency than the conventional B+-tree. However, the original learned index has the problems of insertion failure and unbounded query complexity, meaning that it supports neither insertions nor bounded query complexity. Some variants of the learned index use an out-of-place strategy and a bottom-up build strategy to accelerate insertions and support bounded query complexity, but introduce additional query costs and frequent node splitting operations. Moreover, none of the existing learned indices are cachefriendly. In this paper, aiming to not only support efficient queries and insertions but also offer bounded query complexity, we propose a new learned index called COLIN (Cache-cOnscious Learned INdex). Unlike previous solutions using an out-ofplace strategy, COLIN adopts an in-place approach to support insertions and reserves some empty slots in a node to optimize the node’s data placement. In particular, through model-based data placement and cache-conscious data layout, COLIN decouples the local-search boundary from the maximum error of the model. The experimental results on five workloads and three datasets show that COLIN achieves the best read/write performance among all compared indices and outperforms the second best index by 18.4%, 6.2%, and 32.9% on the three datasets, respectively.