PRICE: A Pretrained Model for Cross-Database Cardinality Estimation

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Zeng, Tianjing, Lan, Junwei, Ma, Jiahong, Wei, Wenqing, Zhu, Rong, Li, Pengfei, Ding, Bolin, Lian, Defu, Wei, Zhewei, Zhou, Jingren
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866915456009371648
author Zeng, Tianjing
Lan, Junwei
Ma, Jiahong
Wei, Wenqing
Zhu, Rong
Li, Pengfei
Ding, Bolin
Lian, Defu
Wei, Zhewei
Zhou, Jingren
author_facet Zeng, Tianjing
Lan, Junwei
Ma, Jiahong
Wei, Wenqing
Zhu, Rong
Li, Pengfei
Ding, Bolin
Lian, Defu
Wei, Zhewei
Zhou, Jingren
contents Cardinality estimation (CardEst) is essential for optimizing query execution plans. Recent ML-based CardEst methods achieve high accuracy but face deployment challenges due to high preparation costs and lack of transferability across databases. In this paper, we propose PRICE, a PRetrained multI-table CardEst model, which addresses these limitations. PRICE takes low-level but transferable features w.r.t. data distributions and query information and elegantly applies self-attention models to learn meta-knowledge to compute cardinality in any database. It is generally applicable to any unseen new database to attain high estimation accuracy, while its preparation cost is as little as the basic one-dimensional histogram-based CardEst methods. Moreover, PRICE can be finetuned to further enhance its performance on any specific database. We pretrained PRICE using 30 diverse datasets, completing the process in about 5 hours with a resulting model size of only about 40MB. Evaluations show that PRICE consistently outperforms existing methods, achieving the highest estimation accuracy on several unseen databases and generating faster execution plans with lower overhead. After finetuning with a small volume of databasespecific queries, PRICE could even find plans very close to the optimal ones. Meanwhile, PRICE is generally applicable to different settings such as data updates, data scaling, and query workload shifts. We have made all of our data and codes publicly available at https://github.com/StCarmen/PRICE.
format Preprint
id arxiv_https___arxiv_org_abs_2406_01027
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle PRICE: A Pretrained Model for Cross-Database Cardinality Estimation
Zeng, Tianjing
Lan, Junwei
Ma, Jiahong
Wei, Wenqing
Zhu, Rong
Li, Pengfei
Ding, Bolin
Lian, Defu
Wei, Zhewei
Zhou, Jingren
Databases
Machine Learning
Cardinality estimation (CardEst) is essential for optimizing query execution plans. Recent ML-based CardEst methods achieve high accuracy but face deployment challenges due to high preparation costs and lack of transferability across databases. In this paper, we propose PRICE, a PRetrained multI-table CardEst model, which addresses these limitations. PRICE takes low-level but transferable features w.r.t. data distributions and query information and elegantly applies self-attention models to learn meta-knowledge to compute cardinality in any database. It is generally applicable to any unseen new database to attain high estimation accuracy, while its preparation cost is as little as the basic one-dimensional histogram-based CardEst methods. Moreover, PRICE can be finetuned to further enhance its performance on any specific database. We pretrained PRICE using 30 diverse datasets, completing the process in about 5 hours with a resulting model size of only about 40MB. Evaluations show that PRICE consistently outperforms existing methods, achieving the highest estimation accuracy on several unseen databases and generating faster execution plans with lower overhead. After finetuning with a small volume of databasespecific queries, PRICE could even find plans very close to the optimal ones. Meanwhile, PRICE is generally applicable to different settings such as data updates, data scaling, and query workload shifts. We have made all of our data and codes publicly available at https://github.com/StCarmen/PRICE.
title PRICE: A Pretrained Model for Cross-Database Cardinality Estimation
topic Databases
Machine Learning
url https://arxiv.org/abs/2406.01027