Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/sql-bench-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ jobs:
chmod +x duckdb
echo "$PWD" >> "$GITHUB_PATH"

# SSB has no Rust generator; `vx-bench prepare-data ssb` builds the reference C `dbgen`
# from source. See vortex-bench/sql/ssb/README.md.
- name: Install cmake
if: matrix.subcommand == 'ssb'
run: sudo apt-get update && sudo apt-get install -y cmake

- uses: ./.github/actions/system-info

- name: Download binaries
Expand Down
2 changes: 1 addition & 1 deletion bench-orchestrator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ vx-bench run <benchmark> [options]

**Arguments:**

- `benchmark`: Benchmark suite to run (`appian`, `tpch`, `tpcds`, `clickbench`, `fineweb`, `gh-archive`, `polarsignals`, `public-bi`, `statpopgen`)
- `benchmark`: Benchmark suite to run (`appian`, `tpch`, `tpcds`, `clickbench`, `fineweb`, `gh-archive`, `polarsignals`, `public-bi`, `ssb`, `statpopgen`)

**Options:**

Expand Down
13 changes: 13 additions & 0 deletions bench-orchestrator/bench_orchestrator/ci_matrix/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,19 @@
"develop": STANDARD_WITH_DUCKDB,
},
),
BenchmarkCase(
id="ssb-nvme",
benchmark=Benchmark.SSB,
name="SSB SF=10 on NVME",
scale_factor=10.0,
iterations=10,
runs={
"pr-compact": COMPACT,
"pr-all": COMPACT,
"pr-full": DEFAULT_WITH_DUCKDB_PR_FULL,
"develop": STANDARD_WITH_DUCKDB,
},
),
BenchmarkCase(
id="vortex-queries",
benchmark=Benchmark.VORTEX_QUERIES,
Expand Down
1 change: 1 addition & 0 deletions bench-orchestrator/bench_orchestrator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Benchmark(Enum):
PUBLIC_BI = "public-bi"
STATPOPGEN = "statpopgen"
SPATIALBENCH = "spatialbench"
SSB = "ssb"
VORTEX_QUERIES = "vortex"


Expand Down
3 changes: 2 additions & 1 deletion bench-orchestrator/tests/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"fineweb-s3",
"polarsignals",
"appian-nvme",
"ssb-nvme",
"vortex-queries",
)
COMPACT_IDS = tuple(
Expand All @@ -42,7 +43,7 @@
"pr": tuple(
benchmark_id
for benchmark_id in REGULAR_IDS
if benchmark_id not in {"tpch-s3-10", "appian-nvme", "vortex-queries"}
if benchmark_id not in {"tpch-s3-10", "appian-nvme", "ssb-nvme", "vortex-queries"}
),
"pr-compact": COMPACT_IDS,
"pr-all": PR_ALL_IDS,
Expand Down
67 changes: 67 additions & 0 deletions vortex-bench/sql/ssb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Star Schema Benchmark

The [Star Schema Benchmark](https://www.cs.umb.edu/~poneil/StarSchemaB.PDF) (O'Neil, O'Neil &
Chen) is TPC-H redesigned as a textbook star schema: TPC-H's `lineitem` and `orders` are
denormalized into one wide `lineorder` fact table, joined against four dimensions — `customer`,
`supplier`, `part`, and `dwdate`.

That shape is what makes it worth running alongside TPC-H. Every query is a scan of the fact
table under dimension-derived filters of a known, deliberately varied selectivity, so the suite
isolates filter pushdown, zone-map pruning, and dimension-join throughput rather than mixing them
with TPC-H's subqueries and correlated predicates.

## Queries

The 13 queries are organized into four "flights", each holding the query shape fixed while
tightening the filters. The harness keys queries on a plain index, so the paper's numbering maps
onto `q1.sql` ... `q13.sql` in order:

| File | SSB | Flight |
| --- | --- | --- |
| `q1.sql` | Q1.1 | Flight 1 — single-dimension discount/quantity filter on `lineorder` x `dwdate` |
| `q2.sql` | Q1.2 | |
| `q3.sql` | Q1.3 | |
| `q4.sql` | Q2.1 | Flight 2 — `part` and `supplier` restriction, grouped by year and brand |
| `q5.sql` | Q2.2 | |
| `q6.sql` | Q2.3 | |
| `q7.sql` | Q3.1 | Flight 3 — `customer` x `supplier` geography join, narrowing region to nation to city |
| `q8.sql` | Q3.2 | |
| `q9.sql` | Q3.3 | |
| `q10.sql` | Q3.4 | |
| `q11.sql` | Q4.1 | Flight 4 — all four dimensions, profit aggregation |
| `q12.sql` | Q4.2 | |
| `q13.sql` | Q4.3 | |

Each file names its SSB query in a leading comment.

## Schema notes

The date dimension is registered as **`dwdate`**, not `date`: `date` is a reserved word in both
DataFusion's and DuckDB's parsers. This is the same rename the reference SSB load scripts apply,
for the same reason. Column names (`d_datekey`, `d_year`, ...) are unchanged.

## Data

There is no Rust SSB generator, and SSB is not derivable from TPC-H output — the dimension
cardinalities differ (`customer` is SF x 30k rather than SF x 150k, `supplier` SF x 2k rather than
SF x 10k, `part` is `200000 * floor(1 + log2(SF))`) and `dwdate` has no TPC-H analogue. So
[`src/ssb/datagen.rs`](../../src/ssb/datagen.rs) clones and builds the pinned reference C `dbgen`,
runs it, and converts its `.tbl` output to Parquet with the `duckdb` CLI. Generating data
therefore needs a C compiler, `cmake`, `git`, and the `duckdb` CLI on `PATH`; everything is
cached and idempotent after the first run.

SSB has no official upstream, only a tree of unsynchronized `dbgen` forks, and they are not
interchangeable — the module docs record which fork is pinned and why. At SF 10 the source
Parquet is ~1.7 GB, dominated by `lineorder`'s 59,986,217 rows.

## CI variant

CI runs this suite at scale factor 10 from local NVMe as the `SSB SF=10 on NVME` PR comment,
comparing DataFusion and DuckDB over Parquet, Vortex, and vortex-compact files (plus a native
DuckDB baseline). Like Appian, it is part of the full SQL matrix rather than the quick PR one.

## Running locally

```bash
vx-bench run ssb --engine datafusion,duckdb --format parquet,vortex --opt scale-factor=10.0
```
11 changes: 11 additions & 0 deletions vortex-bench/sql/ssb/q1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- SSB Q1.1
select
sum(lo_extendedprice * lo_discount) as revenue
from
lineorder,
dwdate
where
lo_orderdate = d_datekey
and d_year = 1993
and lo_discount between 1 and 3
and lo_quantity < 25
25 changes: 25 additions & 0 deletions vortex-bench/sql/ssb/q10.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- SSB Q3.4
select
c_city,
s_city,
d_year,
sum(lo_revenue) as lo_revenue
from
customer,
lineorder,
supplier,
dwdate
where
lo_custkey = c_custkey
and lo_suppkey = s_suppkey
and lo_orderdate = d_datekey
and (c_city = 'UNITED KI1' or c_city = 'UNITED KI5')
and (s_city = 'UNITED KI1' or s_city = 'UNITED KI5')
and d_yearmonth = 'Dec1997'
group by
c_city,
s_city,
d_year
order by
d_year asc,
lo_revenue desc
25 changes: 25 additions & 0 deletions vortex-bench/sql/ssb/q11.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- SSB Q4.1
select
d_year,
c_nation,
sum(lo_revenue - lo_supplycost) as profit
from
dwdate,
customer,
supplier,
part,
lineorder
where
lo_custkey = c_custkey
and lo_suppkey = s_suppkey
and lo_partkey = p_partkey
and lo_orderdate = d_datekey
and c_region = 'AMERICA'
and s_region = 'AMERICA'
and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by
d_year,
c_nation
order by
d_year,
c_nation
29 changes: 29 additions & 0 deletions vortex-bench/sql/ssb/q12.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- SSB Q4.2
select
d_year,
s_nation,
p_category,
sum(lo_revenue - lo_supplycost) as profit
from
dwdate,
customer,
supplier,
part,
lineorder
where
lo_custkey = c_custkey
and lo_suppkey = s_suppkey
and lo_partkey = p_partkey
and lo_orderdate = d_datekey
and c_region = 'AMERICA'
and s_region = 'AMERICA'
and (d_year = 1997 or d_year = 1998)
and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by
d_year,
s_nation,
p_category
order by
d_year,
s_nation,
p_category
28 changes: 28 additions & 0 deletions vortex-bench/sql/ssb/q13.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- SSB Q4.3
select
d_year,
s_city,
p_brand1,
sum(lo_revenue - lo_supplycost) as profit
from
dwdate,
customer,
supplier,
part,
lineorder
where
lo_custkey = c_custkey
and lo_suppkey = s_suppkey
and lo_partkey = p_partkey
and lo_orderdate = d_datekey
and s_nation = 'UNITED STATES'
and (d_year = 1997 or d_year = 1998)
and p_category = 'MFGR#14'
group by
d_year,
s_city,
p_brand1
order by
d_year,
s_city,
p_brand1
11 changes: 11 additions & 0 deletions vortex-bench/sql/ssb/q2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- SSB Q1.2
select
sum(lo_extendedprice * lo_discount) as revenue
from
lineorder,
dwdate
where
lo_orderdate = d_datekey
and d_yearmonthnum = 199401
and lo_discount between 4 and 6
and lo_quantity between 26 and 35
12 changes: 12 additions & 0 deletions vortex-bench/sql/ssb/q3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- SSB Q1.3
select
sum(lo_extendedprice * lo_discount) as revenue
from
lineorder,
dwdate
where
lo_orderdate = d_datekey
and d_weeknuminyear = 6
and d_year = 1994
and lo_discount between 5 and 7
and lo_quantity between 26 and 35
22 changes: 22 additions & 0 deletions vortex-bench/sql/ssb/q4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- SSB Q2.1
select
sum(lo_revenue) as lo_revenue,
d_year,
p_brand1
from
lineorder,
dwdate,
part,
supplier
where
lo_orderdate = d_datekey
and lo_partkey = p_partkey
and lo_suppkey = s_suppkey
and p_category = 'MFGR#12'
and s_region = 'AMERICA'
group by
d_year,
p_brand1
order by
d_year,
p_brand1
22 changes: 22 additions & 0 deletions vortex-bench/sql/ssb/q5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- SSB Q2.2
select
sum(lo_revenue) as lo_revenue,
d_year,
p_brand1
from
lineorder,
dwdate,
part,
supplier
where
lo_orderdate = d_datekey
and lo_partkey = p_partkey
and lo_suppkey = s_suppkey
and p_brand1 between 'MFGR#2221' and 'MFGR#2228'
and s_region = 'ASIA'
group by
d_year,
p_brand1
order by
d_year,
p_brand1
22 changes: 22 additions & 0 deletions vortex-bench/sql/ssb/q6.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- SSB Q2.3
select
sum(lo_revenue) as lo_revenue,
d_year,
p_brand1
from
lineorder,
dwdate,
part,
supplier
where
lo_orderdate = d_datekey
and lo_partkey = p_partkey
and lo_suppkey = s_suppkey
and p_brand1 = 'MFGR#2239'
and s_region = 'EUROPE'
group by
d_year,
p_brand1
order by
d_year,
p_brand1
26 changes: 26 additions & 0 deletions vortex-bench/sql/ssb/q7.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- SSB Q3.1
select
c_nation,
s_nation,
d_year,
sum(lo_revenue) as lo_revenue
from
customer,
lineorder,
supplier,
dwdate
where
lo_custkey = c_custkey
and lo_suppkey = s_suppkey
and lo_orderdate = d_datekey
and c_region = 'ASIA'
and s_region = 'ASIA'
and d_year >= 1992
and d_year <= 1997
group by
c_nation,
s_nation,
d_year
order by
d_year asc,
lo_revenue desc
Loading
Loading