MultiCard: 基于深度学习的多属性基数估计
MultiCard: Multiple Attribute Cardinality Estimation via Deep Learning
Mobina Koochaknia · Maryam Ramezani · Mohammad Hasan Shafaat
中文摘要
基数估计对查询优化至关重要,但现有学习型估计器多局限于单一谓词类型。实际分析负载常混合字符串 LIKE 与数值过滤,且长模式字符串估计精度下降。MultiCard 提出统一架构,结合 Transformer 处理长程稀疏模式与 LSTM 处理短频模式,实现鲁棒模式建模。数值编码器整合目录直方图与结构特征,动态评估不同算子及数据倾斜下的直方图精度。最终 Transformer 层捕获异构谓词交互,由多层感知机预测基数。引入 UPCI 工作负载生成器,产生长度平衡的 LIKE 模式、多列数值谓词及精确基数标签。在五个真实数据集实验中,纯字符串负载下 MultiCard 的 Q-error 达到最优或接近最优;混合多属性查询中,相比 PostgreSQL 平均 Q-error 降低最多 16 倍,推理延迟低于 5 ms。
关键要点
- 01现有估计器多聚焦单一谓词类型,难以处理混合字符串与数值过滤的实际负载。
- 02MultiCard 结合 Transformer 与 LSTM 建模字符串模式,数值编码器整合直方图特征。
- 03引入 UPCI 生成器,提供长度平衡的 LIKE 模式及多列数值谓词用于训练评估。
- 04混合查询中相比 PostgreSQL 平均 Q-error 降低最多 16 倍,推理延迟低于 5 ms。
解读
尚无解读。
原始英文摘要
arXiv:2610.27019v1 Announce Type: cross Abstract: Cardinality estimation is essential for query optimization, but most existing learned estimators focus on a single predicate type, such as string LIKE clauses or numerical range filters. In practice, analytical workloads often combine both types, while the accuracy of string estimators tends to decrease with longer patterns. We introduce MultiCard, a comprehensive learned cardinality estimator that unifies LIKE predicates and numerical filters within a single end-to-end architecture. By combining a Transformer for long-range sparse patterns with an LSTM for short, frequent patterns, MultiCard achieves robust pattern modeling. In parallel, a numerical encoder integrates catalog histograms and structural predicate features, enabling the model to dynamically assess histogram estimation accuracy across different operators and data skew conditions. A final Transformer layer captures interactions among heterogeneous predicates before a multilayer perceptron predicts query cardinalities. We also introduce UPCI, a workload generator that produces length-balanced LIKE patterns, multi-column numerical predicates, and exact cardinality labels for training and evaluation. Experiments on five real-world datasets show that, for string-only workloads, MultiCard achieves the best or near-best Q-error across all datasets compared with state-of-the-art methods. For mixed multi-attribute queries, MultiCard reduces PostgreSQL's mean Q-error by up to 16 times while maintaining an inference latency below 5 ms.