红黑树优化的SQLite索引在测速系统中的应用Application of RB tree optimized SQLite index to velocimeter system
许如峰,杨明武,张青春,邱换春
摘要(Abstract):
针对当前以B树为存储结构的SQLite数据库在处理庞大数据量时效率低下的问题,使用红黑树结构来替换B树结构,并将经红黑树优化过的SQLite应用在交通监控测速仪系统上。首先在Visual Studio 2008环境下分别运行红黑树及B树代码,对随机产生的大量数据执行插入、查询及删除操作,并将上述操作的时间开销进行对比分析;然后将优化的SQLite应用在交通监控测速仪系统中,并同使用原SQLite的同型号设备就处理数据的效率进行对比分析与测试。结果表明,在处理庞大数据时,红黑树对数据的操作效率要远高于B树,当数据量同为600万条时,其插入、查询和删除操作的平均时间开销分别降低68.5%,84.4%和68.8%;同原交通监控测速仪相比,使用经红黑树优化的设备效率提高了40.16%。
关键词(KeyWords): SQLite数据库;数据存储;红黑树;B树;时间开销;交通监控测速仪
基金项目(Foundation): 国家自然科学基金青年科学基金资助项目(61501159)~~
作者(Author): 许如峰,杨明武,张青春,邱换春
DOI: 10.16652/j.issn.1004-373x.2018.04.014
参考文献(References):
- [1]梅强,胡勤友,杨春.基于Android平台的船用北斗通信导航系统设计[J].合肥工业大学学报(自然科学版),2013,36(5):595-598.MEI Qiang,HU Qinyou,YANG Chun.Design of maritime Beidou communication and navigation system based on Android platform[J].Journal of Hefei University of Technology(Natural science edition),2013,36(5):595-598.
- [2]CHEN Dai,HAN Xudong,WANG Wei.Use of SQLite on embedded system[C]//Proceedings of International Conference on Intelligent Computing and Cognitive Informatics.Washington:IEEE Computer Society,2010:210-213.
- [3]陈毅辉,龙昭华.红黑树在RFID标签文件系统中的研究与应用[J].计算机工程与设计,2016,37(10):2837-2843.CHEN Yihui,LONG Zhaohua.Applying red-black tree in RFID tag file system[J].Computer engineering and design,2016,37(10):2837-2843.
- [4]林回祥,程小军.SQLite数据库在雷达日志管理中的应用[J].雷达科学与技术,2016,14(2):194-197.LIN Huixiang,CHENG Xiaojun.Application of SQLite database in radar log management[J].Radar science and technology,2016,14(2):194-197.
- [5]毕攀.基于红黑树的嵌入式数据库SQLite索引机制的优化方案的研究[D].太原:太原科技大学,2012.BI Pan.Optimization study of indexing mechanism of embedded database SQLite Based on red-black tree[D].Taiyuan:Taiyuan University of Science and Technology,2012.
- [6]LüJunyan,XU Shiguo,LI Yijie.Application research of embedded database SQLite[C]//Proceedings of International Forum on Information Technology and Applications.Chengdu:IEEE,2009:539-543.
- [7]ALLEN G,OWENS M.The definitive guide to SQLite[M].2nd ed.New York:Apress,2010.
- [8]JALUTA I.Transaction management in B-tree-indexed database systems[C]//Proceedings of International Conference on Information Science,Electronics and Electrical Engineering.Sapporo:IEEE,2014,3:1968-1975.
- [9]朱阅岸,周烜,张延松,等.多核处理器下事务型数据库性能优化技术综述[J].计算机学报,2015,38(9):1865-1879.ZHU Yuean,ZHOU Xuan,ZHANG Yansong,et al.A Survey of optimization methods for transactional database in multi-core era[J].Chinese journal of computers,2015,38(9):1865-1879.
- [10]CORMEN T H,LEISERSON C E,RIVEST R L,et al.Introduction to Algorithms[M].3rd ed.Cambridge:MIT Press,2009.
- [11]HOONG P K,SHYANG O Y,TAN I K T.Red-black tree architecture for P2P media streaming[C]//Proceedings of IEEE Region 10 Conference.Xi’an:IEEE,2013:1-4.
- [12]HOLENDERSKI M,BRIL R J,LUKKIEN J J.Red-black trees with relative node keys[J].Information processing letters,2014,114(11):591-596.