The query optimizer relies on accurate cardinality estimation to generate efficient execution plans. Despite decades of research, existing cardinality estimation remain inaccurate for complex queries because they often fail to capture positional relationships between input sequences and have certain limitations in mitigating the vanishing gradient problem. Traditional cardinality estimation methods are significantly limited in handling dynamic workloads. Previous deep learning-based approaches to cardinality estimation are mainly data-driven or query-driven. These methods cannot effectively manage dynamic databases and involve substantial overhead during training. Therefore, this paper presents a novel approach to cardinality estimation–APRNet. APRNet involves learnable positional encoding before multi-head self-attention, continuously adjusting the parameters within the positional encoding to enhance the self-attention’s understanding of the relationships between input feature sequences to handle dynamic loads. In addition, M-estimator encoding addresses the issue found in other cardinality estimation models, where query features are converted into binary features, leading to higher data dimensions and increased computational complexity. To avoiding this, the M-estimator allows the MLP layer to handle complex queries more efficiently in dynamic workloads, ultimately improving the accuracy of cardinality estimation. Experiments on dynamic and static workloads show that the proposed method improves the accuracy of cardinality estimation by about 5%.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

APRNet: Cardinality Estimation Method Based on Attention Mechanism

  • Zhengxuan Yang,
  • Yutong Han,
  • Jianxin Zhang

摘要

The query optimizer relies on accurate cardinality estimation to generate efficient execution plans. Despite decades of research, existing cardinality estimation remain inaccurate for complex queries because they often fail to capture positional relationships between input sequences and have certain limitations in mitigating the vanishing gradient problem. Traditional cardinality estimation methods are significantly limited in handling dynamic workloads. Previous deep learning-based approaches to cardinality estimation are mainly data-driven or query-driven. These methods cannot effectively manage dynamic databases and involve substantial overhead during training. Therefore, this paper presents a novel approach to cardinality estimation–APRNet. APRNet involves learnable positional encoding before multi-head self-attention, continuously adjusting the parameters within the positional encoding to enhance the self-attention’s understanding of the relationships between input feature sequences to handle dynamic loads. In addition, M-estimator encoding addresses the issue found in other cardinality estimation models, where query features are converted into binary features, leading to higher data dimensions and increased computational complexity. To avoiding this, the M-estimator allows the MLP layer to handle complex queries more efficiently in dynamic workloads, ultimately improving the accuracy of cardinality estimation. Experiments on dynamic and static workloads show that the proposed method improves the accuracy of cardinality estimation by about 5%.