TPC-H Q8

SF100 · F64 · Estimated plan · Read from bottom to top. Select a step for details.

Plan

Source XML

Loading plan…

Query SQL

Download SQL
/* using 19620718 as a seed to the RNG */
SELECT
  o_year,
  SUM(CASE WHEN nation = 'ETHIOPIA' THEN volume ELSE 0 END) / SUM(volume) AS mkt_share
FROM (
  SELECT
    DATEPART(YEAR, o_orderdate) AS o_year,
    l_extendedprice * (
      1 - l_discount
    ) AS volume,
    n2.n_name AS nation
  FROM part, supplier, lineitem, orders, customer, nation AS n1, nation AS n2, region
  WHERE
    p_partkey = l_partkey
    AND s_suppkey = l_suppkey
    AND l_orderkey = o_orderkey
    AND o_custkey = c_custkey
    AND c_nationkey = n1.n_nationkey
    AND n1.n_regionkey = r_regionkey
    AND r_name = 'AFRICA'
    AND s_nationkey = n2.n_nationkey
    AND o_orderdate BETWEEN CAST('1995-01-01' AS DATE) AND CAST('1996-12-31' AS DATE)
    AND p_type = 'ECONOMY BURNISHED COPPER'
) AS all_nations
GROUP BY
  o_year
ORDER BY
  o_year;
Step details

Loading plan…

Green: scan · yellow: join · purple: row movement. Rows and costs are optimiser estimates; costs use model units.