《计算机应用》唯一官方网站 ›› 2022, Vol. 42 ›› Issue (1): 140-147.DOI: 10.11772/j.issn.1001-9081.2021071217

• 数据科学与技术 • 上一篇    

嵌入式数据库SQLite上多版本并发控制的设计与实现

景子奇, 邹兆年()   

  1. 哈尔滨工业大学 计算机科学与技术学院,哈尔滨 150001
  • 收稿日期:2021-07-14 修回日期:2021-10-09 接受日期:2021-10-12 发布日期:2021-10-09 出版日期:2022-01-10
  • 通讯作者: 邹兆年
  • 作者简介:景子奇(1999—),男,黑龙江大庆人,硕士研究生,CCF会员,主要研究方向:数据库系统
    邹兆年(1979—),男,吉林长春人,教授,博士,CCF会员,主要研究方向:数据库系统、大数据分析。
  • 基金资助:
    国家自然科学基金资助项目(62072138)

Design and implementation of multi-version concurrency control on embedded database SQLite

Ziqi JING, Zhaonian ZOU()   

  1. School of Computer Science and Technology,Harbin Institute of Technology,Harbin Heilongjiang 150001,China
  • Received:2021-07-14 Revised:2021-10-09 Accepted:2021-10-12 Online:2021-10-09 Published:2022-01-10
  • Contact: Zhaonian ZOU
  • About author:JING Ziqi, born in 1999, M. S. candidate. His research interests include database system.
    ZOU Zhaonian, born in 1979, Ph. D., professor. His research interests include database system, big data analysis.
  • Supported by:
    National Natural Science Foundation of China(62072138)

摘要:

针对嵌入式数据库SQLite并发性能较低的问题,提出了一种基于多版本并发控制(MVCC)的并发控制设计。首先,设计了SQLite数据库的以提交的写事务为依据的版本划分方式,重新设计了数据记录的头部字段并以此划分了记录在不同版本访问下的可见性;然后,在SQLite原有结构基础上修改了增、删、查、改等操作与索引结构使得该数据库能在MVCC下工作;最后,对于老旧版本数据提供了一种手动的回收机制。通过实验对比测试了在该设计下的SQLite-MVCC数据库与SQLite数据库的性能区别,发现在并发度较高的状态下SQLite-MVCC数据库在相同时间内可多完成70%以上的事务。实验结果验证了所提设计可以有效提高SQLite的并发性能,使得该数据库可以应对并发情况下的需求。

关键词: 嵌入式数据库SQLite, 事务管理, 调度, 多版本并发控制, 并发执行

Abstract:

In order to solve the problem of low concurrency performance of embedded database SQLite, a concurrency control design based on Multi-Version Concurrency Control (MVCC) was proposed. Firstly, the version division method of SQLite database based on committed write transactions was designed, and the header field of data records was redesigned to divide the visibility of records under different version accesses. Then, based on the original structure of SQLite, the operations such as add, delete, check and change and the index structure were modified to make the database work under MVCC. Finally, a manual recycling mechanism was provided to handle old version data. Experiments were designed to compare and test the performance difference between SQLite-MVCC database obtained by the above design and SQLite database. It can be seen that in the state of high concurrency, SQLite-MVCC database can complete 70% more transactions in the same time. Experimental results verify that the proposed design can effectively improve the concurrency performance of SQLite, to meet the needs in concurrent case.

Key words: embedded database SQLite, transaction management, scheduling, Multi-Version Concurrency Control (MVCC), concurrent execution

中图分类号: