Implementation of INSERT in PostgreSQL in a Segment Tree

Author:

Martynov Vladislav,Plotnikova Natalya

Abstract

Purpose: This article is a continuation of the article [1], which considered a method of optimizing aggregation queries on a continuous range of PostgreSQL databases rows using a segment tree [2–4]. The disadvantage of the considered approach was that the operation of inserting new values into the table took too much time, as it led to a complete rebuilding of the tree. The purpose of this work is to develop a method that allows to significantly speed up the insertion of new items into a table while maintaining up-to-date information in the segment tree. In this article, we propose a method that can significantly speed up the insertion of new items into the table while maintaining up-to-date information in the segment tree. At the same time the gain in aggregating queries is fully preserved. The method is based on the peculiarity of the segment tree, which allows to update elements in it for O(log_2 N) asymptotic. Then we can reduce the problem of adding new values to updating existing elements, which can be solved more efficiently. For this purpose, additional neutral elements are allocated during the construction of the tree. When new values are added to the table, one of these additional elements is updated. When the free elements in the tree run out the tree is rebuilt, again allocating additional memory. The result of this work is the development of an algorithm for updating elements in the tree and its implementation in the form of PostgreSQL Extensions. The speed of the obtained solution has been measured. Conclusions on the results of work and plans for further optimization of operations are made.

Publisher

Bonch-Bruevich State University of Telecommunications

Reference11 articles.

1. Мартынов В. А., Плотникова Н. П. Применение дерева отрезков в PostgreSQL // Инженерный вестник Дона. 2023. № 9 (105). С. 142‒151.

2. Chang Y. K., Lin Y. C. Dynamic Segment Trees for Ranges and Prefixes // IEEE Transactions on Computers. 2007. Vol. 56. Iss. 6. PP. 769–784. DOI: 10.1109/TC.2007.1037

3. Wang L., Wang X. A Simple and Space Efficient Segment Tree Implementation // MethodsX. 2019. Vol. 6. PP. 500–512. DOI: 10.1016/j.mex.2019.02.028

4. Zheng C., Shen G, Li S., Shenker S. Distributed Segment Tree: Support of Range Query and Cover Query over DHT // Proceedings of the 5th International Workshop on Peer-to-Peer Systems (IPTPS). 2006. URL: http://web2.cs.columbia.edu/~cxz/publications/iptps2006-DST.pdf (дата обращения 11.08.2023)

5. Кудрявцев Ю. OLAP-технологии: обзор решаемых задач и исследований // Бизнес-информатика. 2008. № 1(3). С. 66–70.

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3