Skip to content

TPC-Havoc Q9_v7

TPC-Havoc benchmark · all TPC-Havoc queries

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
nation,
o_year,
SUM(l_extendedprice * (
1 - l_discount
) - ps_supplycost * l_quantity) FILTER(WHERE
p_name LIKE '%green%') AS sum_profit
FROM (
SELECT
n_name AS nation,
EXTRACT(YEAR FROM o_orderdate) AS o_year,
l_extendedprice,
l_discount,
ps_supplycost,
l_quantity,
p_name
FROM part, supplier, lineitem, partsupp, orders, nation
WHERE
s_suppkey = l_suppkey
AND ps_suppkey = l_suppkey
AND ps_partkey = l_partkey
AND p_partkey = l_partkey
AND o_orderkey = l_orderkey
AND s_nationkey = n_nationkey
) AS profit
GROUP BY
nation,
o_year
HAVING
sum_profit IS NOT NULL
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_v7'])

Source

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