Sample data: TPC-H¶
TPC Benchmark™ H (TPC-H) 사양에서의 설명에 따르면:
“TPC-H는 결정 지원 벤치마크로, 비즈니스 지향 애드혹 쿼리 및 동시 데이터 수정 모음으로 구성됩니다. 데이터베이스를 채우는 쿼리와 데이터는 광범위한 업계 전반에서 연관성을 갖도록 선택되었습니다. 이 벤치마크는 대규모 데이터를 검사하고 매우 복잡한 쿼리를 실행하며 중요한 비즈니스 질문에 대한 답변을 제공하는 의사결정 지원 시스템을 보여줍니다.”
Database and schemas¶
TPC-H는 다양한 배율 인수를 테스트하기 위해 다양한 크기의 데이터 세트와 함께 제공됩니다. 설명을 위해 Snowflake는 4가지 버전의 TPC-H 데이터를 제공합니다. 데이터는 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 표준 사양)
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;