You are on page 1of 23

数据库系统概论 期末课程设计

期末课程设计
内存数据查询优化策略

北京大学 数据库教研室
1
数据库系统概论 期末课程设计

期末课程设计希望达到的目标
♠ 和课程内容有关联
♠ 是现在的一个研究热点
♠ 是工业界的一个关注焦点
♠ 期末课程设计有评测指标,可积累
♠ 期末课程设计应该支持不同同学的时间和精力安

♣ 时间多的能做的深入,时间少的能做完

2
数据库系统概论 期末课程设计

期末设计的方向
♠ 以数据库查询处理为主
♣ 关系操作符号的设计和优化
♣ 关系数据之上的索引设计
♣ 查询执行计划的代价估计 / 整体优化
♣ 现有环境中 (CPU 新型指令, cache ,大内存等)
对关系数据传统操作的影响

不涉及数据库的新的应用问题,例如, Graph 新的查询等等

3
数据库系统概论 期末课程设计

期末课程设计题目
♠ SIMGOD 2018 Programming Contest
http://sigmod18contest.db.in.tum.de/index.shtml

4
数据库系统概论 期末课程设计

具体任务介绍

5
数据库系统概论 期末课程设计

具体任务介绍 -2

6
数据库系统概论 期末课程设计

环境特点 -1
♠ 内存环境中,不再以 IO 代价为考虑重点
♠ 可以假设内存数量多,但是内存高效的数据结构
还是有必要
♣ 即使数据放入内存没有问题,中间结果很庞大,可
会导致内存不足问题

7
数据库系统概论 期末课程设计

环境特点 -2
♠ CPU
♣ NUMA 结构 Non Uniform Memory Access Architecture
♦ 多核 CPU ,每个有自己独立内存,访问本地内存快,访问其他核
内存慢
♦ 这种场景下的操作和约束,和分布式环境中的操作约束类似
♣ Cache Miss/TLB Miss
♦ 处理数据的最小单位,和 cache line 相关,例如 B+ 树的结点大小
,减少 Cache Miss 的概率
– 太多的指针引用不是一个 Cache 友好的方法
– 太多的过程调用需要频繁保存现场
♦ 处理的变量数据不能太多,减少 TLB Miss

8
数据库系统概论 期末课程设计

环境特点 -3
♠ 同步锁机制
♣ 多核 CPU 环境中,要尽量减少锁的使用
♣ 可以对算法运行做出限制,如分配到不同核的数据
,操作互相独立等
♣ 可以考虑使用无锁指令
♠ 向量指令 SIMD
♣ 指令级别提升条件判定、排序等操作
♣ 查询整体执行中,可以采用向量的批处理执行
9
数据库系统概论 期末课程设计

Top-5 队伍列表

10
数据库系统概论 期末课程设计

Top 1 队伍所用的技术

11
数据库系统概论 期末课程设计

优化的角度
♠ 最底层算法的优化
♣ Hash/Sort 等
♠ 查询执行 Operator 的优化
♣ Join/Aggregator 等
♠ 查询执行计划的优化 , 包括代价估计等
♠ 数据组织和索引结构
♠ 多个查询的联合优化
♠ 代码编译体系结构上的优化
12
数据库系统概论 期末课程设计

1. 内存操作和 Join 算法
1. An Experimental Comparison of Thirteen Relational Equi-Joins in Main Memory. SIGMOD 2016
2. Design and Evaluation of Main Memory Hash Join Algorithms for Multi-core CPUs. SIGMOD
2011
3. Massively Parallel NUMA-Aware Hash Joins. VLDB 2013
4. Memory-efficient hash joins. VLDB 2014
5. Multi-Core, Main-Memory Joins: Sort vs. Hash Revisited VLDB 2013
6. Rethinking SIMD Vectorization for In-Memory Databases. SIGMOD 2015
7. Sort vs. Hash revisited: fast join implementation on modern multi-core CPUs. VLDB 2009
8. Patience is a Virtue: Revisiting Merge and Sort on Modern Processors . SIGMOD 2014
9. A Seven-Dimensional Analysis of Hashing Methods and its Implications on Query Processing.
VLDB 2015
10. Interleaving with Coroutines: A Practical Approach for Robust Index Joins. VLDB 2018
11. Rethinking SIMD Vectorization for In-Memory Databases. SIGMOD 15

13
数据库系统概论 期末课程设计

2. 查询执行树优化
1. How Good are Query Optimizers, Really?. VLDB 2005
2. The MemSQL Query Optimizer, VLDB 2017
3. Neo: A Learned Query Optimize. VLDB 2019
4. Plan-Structured Deep Neural Network Models for Query Performance
Prediction. VLDB 2019
5. Estimating join selectivities using bandwidth-optimized kernel density
models. VLDB 2017
6. FLAT: Fast, Lightweight and Accurate Method for Cardinality
Estimation VLDB 2021
7. Reinforcement Learning with Tree-LSTM for Join Order Selection.
ICDE 2020
8. An End-to-End Learning-based Cost Estimator. VLDB 2020
9. Towards Multi-way Join Aware Optimizer in SAP HANA. VLDB 2020

14
数据库系统概论 期末课程设计

3. 多查询优化
1. MQJoin: efficient shared execution of main-memory
joins. VLDB 2016
2. SharedDB: killing one thousand queries with one stone.
VLDB 2012
3. Shared workload optimization. VLDB 2014
4. WiSeDB: A learning-based workload management
advisor for cloud databases. VLDB 2016
5. Many-query join: efficient shared execution of relational
joins on modern hardware. VLDB 2018
6. Scalable Multi-Query Execution using Reinforcement
Learning. SIGMOD 2021

15
数据库系统概论 期末课程设计

4. 执行和编译
1. Efficiently Compiling Efficient Query Plans for Modern
Hardware. VLDB 2011
2. Everything you always wanted to know compiled and
vectorized queries but afraid to ask. VLDB 2018
3. Relaxed operator fusion for in-memory databases: making
compilation, vectorization, and prefetching work together at
last. VLDB 2017
4. Voodoo - A Vector Algebra for Portable Database Performance
on Modern Hardware. VLDB 2016
5. Permutable Compiled Queries: Dynamically Adapting
Compiled Queries without Recompiling. VLDB 2020
6. How to Architect a Query Compiler. SIGMOD 2016

16
数据库系统概论 期末课程设计

5. 内存索引和数据组织
1. Making B+- trees cache conscious in main memory. SIGMOD 2000
2. Two Birds, One Stone: A Fast, yet Lightweight, Indexing Scheme for Modern
Database Systems. VLDB 2017
3. The Case for Learned Index Structures SIGMOD 2018
4. FITing-Tree: A Data-aware Index Structure. SIGMOD 2019
5. The Adaptive Radix Tree: ARTful Indexing for Main-Memory Databases. ICDE
2013
6. HOT: A Height Optimized Trie Index for Main-Memory Database Systems.
SIGMOD 2018
7. AI Meets AI: Leveraging Query Executions to Improve Index
Recommendations. SIGMOD 2019
8. Cuckoo Index: A Lightweight Secondary Index Structure. VLDB 2020
9. Tsunami: A Learned Multi-dimensional Index for Correlated Data and Skewed
Workloads. VLDB 2020
10. BinDex: A Two-Layered Index for Fast and Robust Scans. SIGMOD 2020

17
数据库系统概论 期末课程设计

期末实验和之前希望达到目标对应关系
♠ 和课程内容有关联
♣ 类似于一个简化版的查询处理器
♠ 是现在的一个研究热点
♣ 需要借助数据库领域近几年的研究成果
♠ 是工业界的一个关注焦点
♣ BAT 、华为都有规模很大的数据管理系统团队
♠ 期末课程设计有评测指标,可积累
♣ 里面带有数据集合、查询集合,可以进行评测,代码和实验结果
可以在下几届同学使用
♠ 期末课程设计应该支持不同同学的时间和精力安排
♣ 可以自己实现,也可以重现 Top-5 队伍提供的代码

18
数据库系统概论 期末课程设计

项目评分
♠ 分析代码,代码测试和复现,小于等于 16 分
♠ + 引入不同的优化策略,但是测试没有明显提升, 17 分
♠ + 引入不同的优化策略,测试相比所改动的代码,有 5% 的性
能提升, 18 分
♠ + 明确优化策略,不同数据集合上和第一名代码相比,测试有
提升, 19 分
♠ + 明确优化策略,不同数据集合上和第一名代码相比,有 5%
的性能提升, 20 分

19
数据库系统概论 期末课程设计

期末作业的基准代码和数据
♠ https://disk.pku.edu.cn:443/link/
9C19A19541060B66DAD9EFECA306712B
有效期限: 2022-06-25 23:59

20
数据库系统概论 期末课程设计

后续时间安排 期中作业

同学报告 1 同学报告

同学报告 同学报告

同学报告

考试时间 期末作业
21
数据库系统概论 期末课程设计

关于期末作业
♠ 建议组队完成,每个队伍 1-2 位同学
♠ 最后的作业是对现有代码的优化和提升
♠ 所使用的方法可能是经过调研之后,相关研究工
作的思路和自己的思路
♠ 期末作业和课堂报告有关系
♠ 课堂报告鼓励 2 位同学做同一个报告

22
数据库系统概论 期末课程设计

课堂报告的选择
♠ 和课程期末作业相关
♣ 部分可能能够在最终课程大作业中发挥作用
♣ 部分可能是扩展思路
♠ 相对经典或者相对新的研究成果
♠ 如果自己有感兴趣的文档,可以和老师协商后,追加到文档列表中
♠ 课堂报告是交流和心得,不是任务
♠ 其他同学报告的思路,只要感觉可用或者有兴趣,都可以在最终的作业中体现
♠ 大家在微信群里接龙,可用章节 . 论文编号
♣ 例如,张三 李四 -4.2 ,表示第 4 编译执行的第 2 个论文
♠ 微信接龙后,根据拼音排序 ( 两个同学按照排序小的 ) 具体报告时间
♠ 给出报告时间后,可同学内部调整,但教师无法实现调整

23

You might also like