Journal of Computer Applications

    Next Articles

On-chain data query optimization based on hybrid index

  

  • Received:2025-01-17 Revised:2025-04-01 Online:2025-04-27 Published:2025-04-27

基于混合索引的链上数据查询优化

张瑞阳1,赵明洁1,郭兵2,江平洪3   

  1. 1. 四川大学计算机学院
    2. 四川大学 计算机学院
    3. 成都市公共资源交易服务中心
  • 通讯作者: 张瑞阳
  • 基金资助:
    国家自然科学基金铁路基础研究联合基金项目

Abstract: Aiming at the problems of low query efficiency and limited query types in on-chain data querying of blockchain systems, an inter-block index model was proposed. Firstly, for discrete attributes within blocks, Inverted Bloom Filters (IBFS) index was introduced. When querying data using IBFS, it allows for locating target block in O(1) time complexity without full blockchain traversal. Secondly, for continuous attributes, clustering algorithm was employed to calculate fine-grained data distribution intervals. Dual-Layer Clustering Chain (DLCC) index was constructed based on maximum/minimum values and data distribution intervals, enabling the filtering of more non-target blocks during queries. Then, based on the proposed index model, various query algorithms were designed and implemented. Experimental results show that compared with Tree Bloom Filter index, the storage space of IBFS index is reduced by 51.0%, and time to locate target blocks is shortened by 75.9%. Compared with Start-End interval index, the number of blocks located by DLCC index during range query is reduced by 55.5%.

Key words: Blockchain, query optimization, index model, Bloom filter, clustering algorithm

摘要: 针对区块链系统在链上数据查询上查询效率低、查询类型少的问题,提出一种区块间索引模型。首先,对于区块中离散型属性,提出倒排布隆过滤器(Inverted Bloom Filters,IBFS)索引。使用该索引查询数据时无需遍历全部区块,可以在O(1)时间复杂度内定位到目标区块。其次,对于连续型属性,使用聚类算法计算区块内数据细粒度分布区间,结合区块内数据的最大最小值构建双层聚类链表(Dual-Layer Clustering Chain,DLCC)索引,查询数据时可过滤更多不含目标数据的区块。然后,在所提索引模型的基础上,设计并实现了多种查询算法。实验结果表明,与树型布隆过滤器索引相比,IBFS索引占用的存储空间降低了51.0%,定位到目标区块的时间减少了75.9%。与起止区间索引相比,DLCC索引在范围查询时定位到的区块数目减少了55.5%。

关键词: 区块链, 查询优化, 索引模型, 布隆过滤器, 聚类算法

CLC Number: