github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/workload/querybench/2.1-sql-20 (about)

     1  -- 2.1-sql-20 is a library of significant queries for benchmarking SQL execution
     2  -- during the 2.1 release cycle. These are intended to be run against the TPC-H
     3  -- dataset.
     4  --
     5  -- To load the data:
     6  --   > CREATE DATABASE tpch;
     7  --   > RESTORE workload.* FROM 'gs://cockroach-fixtures/workload/tpch/scalefactor=1/backup' WITH into_db = 'tpch';
     8  --
     9  -- To run the queries using the querybench workload:
    10  --   $ workload run querybench --concurrency 1 --max-ops 20 --db tpch --query-file 2.1-sql-20
    11  --
    12  -- Table sizes:
    13  --   supplier:    10,000 rows
    14  --   customer:   150,000 rows
    15  --   lineitem: 6,001,215 rows
    16  
    17  -- count(*)
    18  SELECT count(*) FROM lineitem
    19  
    20  -- count(*) with filter on non-indexed column
    21  SELECT count(*) FROM lineitem WHERE l_linenumber = 1
    22  
    23  -- SELECT *
    24  SELECT * FROM customer
    25  
    26  -- SELECT * ordered on non-indexed, non-sorted column
    27  SELECT * FROM customer ORDER BY c_address
    28  
    29  -- GROUP BY with COUNT
    30  SELECT l_linenumber, count(*) FROM lineitem GROUP BY 1 ORDER BY 1
    31  
    32  -- GROUP BY with MAX
    33  SELECT l_linenumber, max(l_quantity) FROM lineitem GROUP BY 1 ORDER BY 1
    34  
    35  -- GROUP BY with SUM
    36  SELECT l_linenumber, sum(l_quantity) FROM lineitem GROUP BY 1 ORDER BY 1
    37  
    38  -- DISTINCT
    39  SELECT count(DISTINCT l_suppkey) FROM lineitem
    40  
    41  -- Hash join
    42  SELECT count(*) FROM lineitem JOIN supplier ON l_suppkey = s_suppkey
    43  
    44  -- Merge join
    45  SELECT count(*) FROM lineitem@l_sk JOIN supplier@primary ON l_suppkey = s_suppkey
    46  
    47  -- count(col)
    48  SELECT count(c_name) FROM customer
    49  
    50  -- Index join
    51  SELECT count(c_name) FROM customer@primary
    52  
    53  -- Filter with expression evaluation
    54  SELECT count(*) FROM lineitem WHERE l_discount * l_extendedprice > 10000
    55  
    56  -- Hash join with expression evaluation
    57  SELECT count(*) FROM supplier s1 JOIN supplier s2 ON s1.s_suppkey + 1 = s2.s_suppkey