[论文]Are We Ready For Learned Cardinality Estimation?
实验环境搭建与代码探索
环境搭建
- 使用python3.7
- 将文件pyproject.toml中的 pomegranate 库版本改为 pomegranate= “0.14.0”
- cd进项目文件夹,先poetry lock然后poetry install。则可成功安装环境,如图,出现install lecarb(0.1.0)即成功
代码探索
数据准备
数据文件下载后解压
此时项目文件内容如图
repo中定义了Table,其中包含数据,一些常用的统计信息和函数,以方便使用。详情请参阅
lecarb/dataset/dataset.py
。在此repo中大多数方法都使用Table做为数据集输入。
此时可以成功运行just csv2pkl data/census13/original.csv
,但是just pkl2table census13 original
会失败,原因为环境变量未导入,justfile文件中加一行set dotenv-load := true
即可解决
实验结果
train
naru:
7.1min
lecarb.estimator.utils: {'max': 6.0, '99th': 3.525000000000013, '95th': 2.004838709677419, '90th': 2.0, 'median': 1.083885141186961, 'mean': 1.314389411417743, 'gmean': 1.238385430697998}
test:
33.4243782043457 ms/query in average
lecarb.estimator.utils: {'max': 227.0, '99th': 4.133337209302326, '95th': 2.4, '90th': 2.0, 'median': 1.0946315778423197, 'mean': 1.358211731076198, 'gmean': 1.250229373237422}