Sample data: TPC-H

TPC Benchmark™H(TPC-H) 仕様で説明されているように、

「TPC-Hは意思決定支援ベンチマークです。これは、一連のビジネス指向のアドホッククエリと同時データ変更で構成されています。データベースに入力するクエリとデータは、業界全体に広く関連するように選択されています。このベンチマークは、大量データを調査し、高度な複雑さでクエリを実行し、重要なビジネス上の質問に答える意思決定支援システムを示しています。」

Database and schemas

TPC-Hには、異なるスケーリング係数をテストするためのさまざまなデータセットサイズが付属しています。デモ目的のために、TPC-Hデータの4つのバージョンを共有しました。データは、SNOWFLAKE_SAMPLE_DATA 共有データベースの次のスキーマで提供されます。

  • TPCH_SF1: 基本行サイズで構成されます(数百万の要素)。

  • TPCH_SF10: 基本行サイズx 10で構成されます。

  • TPCH_SF100: 基本行サイズx 100(数億の要素)で構成されます。

  • TPCH_SF1000: 基本行サイズx 1000(数十億の要素)で構成されます。

Database entities, relationships, and characteristics

TPC-Hのコンポーネントは、8つの個別のテーブル(ベーステーブル)で構成されています。これらのテーブルの列間の関係を次の ER 図に示します。

TPC-Hベンチマークデータのスキーマ

(ソース: TPC ベンチマークH標準仕様

Query definitions

Each TPC-H query asks a business question and includes the corresponding query to answer the question. Some of the TPC-H queries are included in Snowflake's Get Started tutorials.

This section describes one of the queries. For more information about TPC-H and all the queries that are involved, see the official TPC Benchmark H Standard Specification.

Q1: Pricing summary report query

このクエリは、請求、発送、返品されたビジネスの量を報告します。

Business question

The Pricing Summary Report Query provides a summary pricing report for all line items that were shipped as of a given date. The date is within 60-120 days of the greatest ship date contained in the database.

Functional query definition

クエリは、合計価格、割引合計価格、割引合計価格と税金、平均数量、平均合計価格、および平均割引の合計をリストします。これらの集計は、RETURNFLAG と LINESTATUS でグループ化され、RETURNFLAG と LINESTATUS の昇順でリストされます。各グループのラインアイテム数の件数が含まれます。

use schema snowflake_sample_data.tpch_sf1;   -- or snowflake_sample_data.{tpch_sf10 | tpch_sf100 | tpch_sf1000}

select
       l_returnflag,
       l_linestatus,
       sum(l_quantity) as sum_qty,
       sum(l_extendedprice) as sum_base_price,
       sum(l_extendedprice * (1-l_discount)) as sum_disc_price,
       sum(l_extendedprice * (1-l_discount) * (1+l_tax)) as sum_charge,
       avg(l_quantity) as avg_qty,
       avg(l_extendedprice) as avg_price,
       avg(l_discount) as avg_disc,
       count(*) as count_order
 from
       lineitem
 where
       l_shipdate <= dateadd(day, -90, to_date('1998-12-01'))
 group by
       l_returnflag,
       l_linestatus
 order by
       l_returnflag,
       l_linestatus;
Copy