【索引】反向索引

简介: 1,Creating dataReversed key indexes use b-tree structures, but preprocess key values before inserting them.
1,Creating data
Reversed key indexes use b-tree structures, but preprocess key values before inserting them. Simplifying, b-trees place similar values on a single index block, e.g., storing 24538 on the same block as 24539. This makes them efficient both for looking up a specific value and for finding values within a range. However if the application inserts values in sequence, each insert must have access to the newest block in the index in order to add the new value. If many users attempt to insert at the same time, they all must write to that block and have to get in line, slowing down the application. This is particularly a problem in clustered databases, which may require the block to be copied from one computer's memory to another's to allow the next user to perform. their insert.

Reversing the key spreads similar new values across the entire index instead of concentrating them in any one leaf block. This means that 24538 appears on the same block as 14538 while 24539 goes to a different block, eliminating this cause of contention. (Since 14538 would have been created long before 24538, their inserts don't interfere with each other.)


2,Querying data
Reverse indexes are just as effective as for finding specific values, although they aren't helpful for range queries, which turn out to be uncommon for artificial values such as sequence numbers. When searching the index, the query processor simply reverses the search target before looking it up.

3,Deleting data
Another benefit impacts applications that delete data. Typically, applications delete data that is older on average (with lower values of the sequence) before deleting newer data. In standard b-trees, many index blocks end up containing few values, with a commensurate increase in unused space, referred to as "rot". Rot not only wastes space, but slows query speeds, because a smaller fraction of a rotten index's blocks fit in memory at any one time. In a b-tree, if 14538 gets deleted, its index space remains empty. In a reverse index, if 14538 goes before 24538 arrives, 24538 can reuse 14538's space.
目录
相关文章
|
芯片
软件体系结构 - 精简指令集架构 (RISC)
【4月更文挑战第17天】软件体系结构 - 精简指令集架构 (RISC)
249 1
|
算法 大数据 Python
局部异常因子(LOF)
局部异常因子(LOF)
|
存储 监控 调度
Android系统服务:WMS、AMS相关知识
参考文献 Android窗口管理服务WindowManagerService计算Activity窗口大小的过程分析 Android窗口管理服务WindowManagerService显示Activity组件的启动窗口(Starting Window)的过程分析 Android窗口管理服务WindowManagerService对输入法窗口(Input Method Window)的管理分析 Android窗口管理服务WindowManagerService显示窗口动画的原理分析
|
Java 应用服务中间件 Maven
SpringBoot(三)之打包方式
在 mainClass 元素中指定主类的完全限定名,这是可执行 JAR 文件的入口点。
796 0
|
人工智能 前端开发 算法
安信可VC系列语音识别的使用教程
安信可VC系列语音识别的使用教程
安信可VC系列语音识别的使用教程
|
新零售 搜索推荐
全民拼团商城系统开发|成熟案例|需求详情
无论未来做什么样的社交+零售模式,都离不开社区。
|
Cloud Native Java Go
《Spring Boot前世今生》
《Spring Boot前世今生》
154 0
|
传感器 机器学习/深度学习 自然语言处理
ICRA 2022最佳论文出炉:美团无人机团队获唯一最佳导航论文奖
ICRA 2022最佳论文出炉:美团无人机团队获唯一最佳导航论文奖
309 0
|
设计模式 SQL 存储
【MyBatis】面试官:MyBatis中是如何使用设计模式的?
本篇文章了解一下MyBatis中运用到的设计模式,我们在实际的开发中很大程度上只是对设计模式留在一个理论的环节上,缺少实践,通过源码,我们可以学习一下这些设计模式的实践方式,有利于我们能够更深入的理解和使用设计模式。
|
弹性计算 数据库
第一次使用阿里云
走进服务器的大门
168 1