Skip to content

TPC-Havoc Q9_v3

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
nation,
o_year,
SUM(amount) AS sum_profit
FROM (
SELECT
n.n_name AS nation,
EXTRACT(YEAR FROM o.o_orderdate) AS o_year,
l.l_extendedprice * (
1 - l.l_discount
) - ps.ps_supplycost * l.l_quantity AS amount
FROM part AS p
INNER JOIN lineitem AS l
ON p.p_partkey = l.l_partkey
INNER JOIN supplier AS s
ON l.l_suppkey = s.s_suppkey
INNER JOIN partsupp AS ps
ON s.s_suppkey = ps.ps_suppkey AND p.p_partkey = ps.ps_partkey
INNER JOIN orders AS o
ON l.l_orderkey = o.o_orderkey
INNER JOIN nation AS n
ON s.s_nationkey = n.n_nationkey
WHERE
p.p_name LIKE '%green%'
) AS profit
GROUP BY
nation,
o_year
ORDER BY
nation,
o_year DESC

Representative DataFrame

No DataFrame implementation is registered for this query.

Get the exact query for your run

The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:

from benchbox import TPCHavoc
bench = TPCHavoc(scale_factor=0.01) # your scale factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['9_v3'])

Source

Query text: benchbox/core/tpchavoc/variant_sets/q09.py