dbsched models
Weights of the components of dbsched, pipeline-level query scheduling for DuckDB. Each component has its own folder; a file is named after the time its training run wrote it.
The repository mirrors data/weights/dbsched/ of a dbsched checkout (python -m scripts.data.hub pull weights). Weights are put here by hand, from the training runs' output in data/weights/dev/<component>/.
pqueryformer
PQueryFormer predicts, for each pipeline of a query plan, its CPU time. A checkpoint is a torch.save of a dict with the model's state_dict (model), its hyperparameters (args), the encoding it was trained with (encoding), and the bounds of the label normalizer (pipe_norm). It is a pickle: load it with torch.load(path, weights_only=False) from a dbsched checkout, and only if you trust its source.
| File | Trained on |
|---|---|
pqueryformer/20261108-193426.pt |
JOB-D and CEB (33,644 queries) on the scale-32 IMDB database, traces without per-role operator timings |
pqueryformer/20261113-223818.pt |
JOB, JOB-light, JOB-ext, JOB-D, CEB, JOB-light-scaled, JOB-ext-scaled and MSCN on the scale-32 IMDB database. Pipeline CPU-time q-error on their test splits (14,924 queries): median 1.19, 90th percentile 2.03. The frozen encoder of simulator/20261123-061146. |
python -m pqueryformer eval data/weights/dbsched/pqueryformer/20261108-193426.pt
simulator
The progress simulator predicts, at every 1 ms tick, how many chunks each running pipeline completes and how far its finalize gets, given which pipelines share the machine and how many threads each has. It predicts corrections to each pipeline's solo profile (the rate it would have alone on the same threads). A simulator model is a folder, not a single file:
model.pt: atorch.saveof a dict with the model'sstate_dict(model), its configuration (config: architecture, features, the solo profiles it uses) and its input normalizers (normalizers). It is a pickle: load it withtorch.load(path, weights_only=False), and only if you trust its source.inference.json: what inference needs besides the weights: which checkpoint, the median baselines for pipelines without a profiled rate or finalize, the tick length, and (pqueryformer) the PQueryFormer checkpoint it runs on.
A simulator model reads each pipeline's embedding from a frozen PQueryFormer, so it runs on one specific PQueryFormer checkpoint of this repository, named in its inference.json and in the table below. The embeddings are computed once per query pool and cached; python -m simulator run prints the command that makes the cache when it is missing:
DB_DATASET=job32 QUERY_DATASET=mscn python -m simulator embed \
--checkpoint data/weights/dbsched/pqueryformer/20261113-223818.pt \
--pool data/dataset/imdb/simulator/job32/mscn-5000/pool.json \
--out data/dataset/imdb/simulator/job32/mscn-5000/embeddings-20261113-223818.npz
The solo profiles, plans and simulator traces come from the dataset repository, so pull the dataset first.
| Folder | PQueryFormer | Trained on |
|---|---|---|
simulator/20261123-061146 |
pqueryformer/20261113-223818.pt |
Simulator traces of the mscn-5000 pool on the scale-32 IMDB database, 16 threads: chunks 0 and 1 of the equal-c8 and random-c4, c8 and c16 runs (1,176 training and 207 held-out queries); epoch 3, the best on the held-out queries. Corrections bounded to ยฑ5 in log; pipelines with no source chunks left out of the loss. Held-out q-error, median / 90th percentile: execute time left 1.13 / 1.95, whole execute phase 1.15 / 2.00, finalize 1.20 / 1.76. |
python -m simulator run --package data/weights/dbsched/simulator/20261123-061146 \
--trace data/dataset/imdb/simulator/job32/mscn-5000/equal-c8-t16-tick1000us-s0/trace/chunk_0000 \
--policy fifo
Known limits: a hash join that spills under memory pressure does real work in a pipeline that has none in the solo profiles, which this model cannot predict (about 20% of execute time at 16 connections); and in the simulator, new pipelines get their first threads sooner than in DuckDB, so short queries finish too fast.