aqetuner / workloads / tpcds_sql_create_table.sql
tpcds_sql_create_table.sql
Raw
create table catalog_returns (
  cr_returned_date_sk Nullable(Int64),
  cr_returned_time_sk Nullable(Int64),
  cr_item_sk Int64,
  cr_refunded_customer_sk Nullable(Int64),
  cr_refunded_cdemo_sk Nullable(Int64),
  cr_refunded_hdemo_sk Nullable(Int64),
  cr_refunded_addr_sk Nullable(Int64),
  cr_returning_customer_sk Nullable(Int64),
  cr_returning_cdemo_sk Nullable(Int64),
  cr_returning_hdemo_sk Nullable(Int64),
  cr_returning_addr_sk Nullable(Int64),
  cr_call_center_sk Nullable(Int64),
  cr_catalog_page_sk Nullable(Int64),
  cr_ship_mode_sk Nullable(Int64),
  cr_warehouse_sk Nullable(Int64),
  cr_reason_sk Nullable(Int64),
  cr_order_number Int64,
  cr_return_quantity Nullable(Int64),
  cr_return_amount Nullable(Float64),
  cr_return_tax Nullable(Float64),
  cr_return_amt_inc_tax Nullable(Float64),
  cr_fee Nullable(Float64),
  cr_return_ship_cost Nullable(Float64),
  cr_refunded_cash Nullable(Float64),
  cr_reversed_charge Nullable(Float64),
  cr_store_credit Nullable(Float64),
  cr_net_loss Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY cr_item_sk into 128 buckets
order by cr_item_sk;
create table catalog_sales (
  cs_sold_date_sk Nullable(Int64),
  cs_sold_time_sk Nullable(Int64),
  cs_ship_date_sk Nullable(Int64),
  cs_bill_customer_sk Nullable(Int64),
  cs_bill_cdemo_sk Nullable(Int64),
  cs_bill_hdemo_sk Nullable(Int64),
  cs_bill_addr_sk Nullable(Int64),
  cs_ship_customer_sk Nullable(Int64),
  cs_ship_cdemo_sk Nullable(Int64),
  cs_ship_hdemo_sk Nullable(Int64),
  cs_ship_addr_sk Nullable(Int64),
  cs_call_center_sk Nullable(Int64),
  cs_catalog_page_sk Nullable(Int64),
  cs_ship_mode_sk Nullable(Int64),
  cs_warehouse_sk Nullable(Int64),
  cs_item_sk Int64,
  cs_promo_sk Nullable(Int64),
  cs_order_number Int64,
  cs_quantity Nullable(Int64),
  cs_wholesale_cost Nullable(Float64),
  cs_list_price Nullable(Float64),
  cs_sales_price Nullable(Float64),
  cs_ext_discount_amt Nullable(Float64),
  cs_ext_sales_price Nullable(Float64),
  cs_ext_wholesale_cost Nullable(Float64),
  cs_ext_list_price Nullable(Float64),
  cs_ext_tax Nullable(Float64),
  cs_coupon_amt Nullable(Float64),
  cs_ext_ship_cost Nullable(Float64),
  cs_net_paid Nullable(Float64),
  cs_net_paid_inc_tax Nullable(Float64),
  cs_net_paid_inc_ship Nullable(Float64),
  cs_net_paid_inc_ship_tax Nullable(Float64),
  cs_net_profit Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY cs_item_sk into 128 buckets
order by cs_item_sk;
create table inventory (
  inv_date_sk Int64,
  inv_item_sk Int64,
  inv_warehouse_sk Int64,
  inv_quantity_on_hand Nullable(Int64)
) ENGINE = CnchMergeTree() CLUSTER BY inv_item_sk into 128 buckets
order by inv_item_sk;
create table store_returns (
  sr_returned_date_sk Nullable(Int64),
  sr_return_time_sk Nullable(Int64),
  sr_item_sk Int64,
  sr_customer_sk Nullable(Int64),
  sr_cdemo_sk Nullable(Int64),
  sr_hdemo_sk Nullable(Int64),
  sr_addr_sk Nullable(Int64),
  sr_store_sk Nullable(Int64),
  sr_reason_sk Nullable(Int64),
  sr_ticket_number Int64,
  sr_return_quantity Nullable(Int64),
  sr_return_amt Nullable(Float64),
  sr_return_tax Nullable(Float64),
  sr_return_amt_inc_tax Nullable(Float64),
  sr_fee Nullable(Float64),
  sr_return_ship_cost Nullable(Float64),
  sr_refunded_cash Nullable(Float64),
  sr_reversed_charge Nullable(Float64),
  sr_store_credit Nullable(Float64),
  sr_net_loss Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY sr_item_sk into 128 buckets
order by sr_item_sk;
create table store_sales (
  ss_sold_date_sk Nullable(Int64),
  ss_sold_time_sk Nullable(Int64),
  ss_item_sk Int64,
  ss_customer_sk Nullable(Int64),
  ss_cdemo_sk Nullable(Int64),
  ss_hdemo_sk Nullable(Int64),
  ss_addr_sk Nullable(Int64),
  ss_store_sk Nullable(Int64),
  ss_promo_sk Nullable(Int64),
  ss_ticket_number Int64,
  ss_quantity Nullable(Int64),
  ss_wholesale_cost Nullable(Float64),
  ss_list_price Nullable(Float64),
  ss_sales_price Nullable(Float64),
  ss_ext_discount_amt Nullable(Float64),
  ss_ext_sales_price Nullable(Float64),
  ss_ext_wholesale_cost Nullable(Float64),
  ss_ext_list_price Nullable(Float64),
  ss_ext_tax Nullable(Float64),
  ss_coupon_amt Nullable(Float64),
  ss_net_paid Nullable(Float64),
  ss_net_paid_inc_tax Nullable(Float64),
  ss_net_profit Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY ss_item_sk into 128 buckets
order by ss_item_sk;
create table web_returns (
  wr_returned_date_sk Nullable(Int64),
  wr_returned_time_sk Nullable(Int64),
  wr_item_sk Int64,
  wr_refunded_customer_sk Nullable(Int64),
  wr_refunded_cdemo_sk Nullable(Int64),
  wr_refunded_hdemo_sk Nullable(Int64),
  wr_refunded_addr_sk Nullable(Int64),
  wr_returning_customer_sk Nullable(Int64),
  wr_returning_cdemo_sk Nullable(Int64),
  wr_returning_hdemo_sk Nullable(Int64),
  wr_returning_addr_sk Nullable(Int64),
  wr_web_page_sk Nullable(Int64),
  wr_reason_sk Nullable(Int64),
  wr_order_number Int64,
  wr_return_quantity Nullable(Int64),
  wr_return_amt Nullable(Float64),
  wr_return_tax Nullable(Float64),
  wr_return_amt_inc_tax Nullable(Float64),
  wr_fee Nullable(Float64),
  wr_return_ship_cost Nullable(Float64),
  wr_refunded_cash Nullable(Float64),
  wr_reversed_charge Nullable(Float64),
  wr_account_credit Nullable(Float64),
  wr_net_loss Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY wr_item_sk into 128 buckets
order by wr_item_sk;
create table web_sales (
  ws_sold_date_sk Nullable(Int64),
  ws_sold_time_sk Nullable(Int64),
  ws_ship_date_sk Nullable(Int64),
  ws_item_sk Int64,
  ws_bill_customer_sk Nullable(Int64),
  ws_bill_cdemo_sk Nullable(Int64),
  ws_bill_hdemo_sk Nullable(Int64),
  ws_bill_addr_sk Nullable(Int64),
  ws_ship_customer_sk Nullable(Int64),
  ws_ship_cdemo_sk Nullable(Int64),
  ws_ship_hdemo_sk Nullable(Int64),
  ws_ship_addr_sk Nullable(Int64),
  ws_web_page_sk Nullable(Int64),
  ws_web_site_sk Nullable(Int64),
  ws_ship_mode_sk Nullable(Int64),
  ws_warehouse_sk Nullable(Int64),
  ws_promo_sk Nullable(Int64),
  ws_order_number Int64,
  ws_quantity Nullable(Int64),
  ws_wholesale_cost Nullable(Float64),
  ws_list_price Nullable(Float64),
  ws_sales_price Nullable(Float64),
  ws_ext_discount_amt Nullable(Float64),
  ws_ext_sales_price Nullable(Float64),
  ws_ext_wholesale_cost Nullable(Float64),
  ws_ext_list_price Nullable(Float64),
  ws_ext_tax Nullable(Float64),
  ws_coupon_amt Nullable(Float64),
  ws_ext_ship_cost Nullable(Float64),
  ws_net_paid Nullable(Float64),
  ws_net_paid_inc_tax Nullable(Float64),
  ws_net_paid_inc_ship Nullable(Float64),
  ws_net_paid_inc_ship_tax Nullable(Float64),
  ws_net_profit Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY ws_item_sk into 128 buckets
order by ws_item_sk;
create table call_center (
  cc_call_center_sk Int64,
  cc_call_center_id String,
  cc_rec_start_date Nullable(date) default null,
  cc_rec_end_date Nullable(date) default null,
  cc_closed_date_sk Nullable(Int64),
  cc_open_date_sk Nullable(Int64),
  cc_name Nullable(String),
  cc_class Nullable(String),
  cc_employees Nullable(Int64),
  cc_sq_ft Nullable(Int64),
  cc_hours Nullable(String),
  cc_manager Nullable(String),
  cc_mkt_id Nullable(Int64),
  cc_mkt_class Nullable(String),
  cc_mkt_desc Nullable(String),
  cc_market_manager Nullable(String),
  cc_division Nullable(Int64),
  cc_division_name Nullable(String),
  cc_company Nullable(Int64),
  cc_company_name Nullable(String),
  cc_street_number Nullable(String),
  cc_street_name Nullable(String),
  cc_street_type Nullable(String),
  cc_suite_number Nullable(String),
  cc_city Nullable(String),
  cc_county Nullable(String),
  cc_state Nullable(String),
  cc_zip Nullable(String),
  cc_country Nullable(String),
  cc_gmt_offset Nullable(Float64),
  cc_tax_percentage Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY cc_call_center_sk INTO 128 BUCKETS
ORDER BY cc_call_center_sk;
create table catalog_page (
  cp_catalog_page_sk Int64,
  cp_catalog_page_id String,
  cp_start_date_sk Nullable(Int64),
  cp_end_date_sk Nullable(Int64),
  cp_department Nullable(String),
  cp_catalog_number Nullable(Int64),
  cp_catalog_page_number Nullable(Int64),
  cp_description Nullable(String),
  cp_type Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY cp_catalog_page_sk INTO 128 BUCKETS
ORDER BY cp_catalog_page_sk;
CREATE TABLE customer (
  c_customer_sk Int64,
  c_customer_id String,
  c_current_cdemo_sk Nullable(Int64),
  c_current_hdemo_sk Nullable(Int64),
  c_current_addr_sk Nullable(Int64),
  c_first_shipto_date_sk Nullable(Int64),
  c_first_sales_date_sk Nullable(Int64),
  c_salutation Nullable(String),
  c_first_name Nullable(String),
  c_last_name Nullable(String),
  c_preferred_cust_flag Nullable(String),
  c_birth_day Nullable(Int64),
  c_birth_month Nullable(Int64),
  c_birth_year Nullable(Int64),
  c_birth_country Nullable(String),
  c_login Nullable(String),
  c_email_address Nullable(String),
  c_last_review_date_sk Nullable(Int64)
) ENGINE = CnchMergeTree() CLUSTER BY c_customer_sk INTO 128 BUCKETS
ORDER BY c_customer_sk;
CREATE TABLE customer_address (
  ca_address_sk Int64,
  ca_address_id String,
  ca_street_number Nullable(String),
  ca_street_name Nullable(String),
  ca_street_type Nullable(String),
  ca_suite_number Nullable(String),
  ca_city Nullable(String),
  ca_county Nullable(String),
  ca_state Nullable(String),
  ca_zip Nullable(String),
  ca_country Nullable(String),
  ca_gmt_offset Nullable(Float64),
  ca_location_type Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY ca_address_sk INTO 128 BUCKETS
ORDER BY ca_address_sk;
create table customer_demographics (
  cd_demo_sk Int64,
  cd_gender Nullable(String),
  cd_marital_status Nullable(String),
  cd_education_status Nullable(String),
  cd_purchase_estimate Nullable(Int64),
  cd_credit_rating Nullable(String),
  cd_dep_count Nullable(Int64),
  cd_dep_employed_count Nullable(Int64),
  cd_dep_college_count Nullable(Int64)
) ENGINE = CnchMergeTree() CLUSTER BY cd_demo_sk INTO 128 BUCKETS
ORDER BY cd_demo_sk;
create table date_dim (
  d_date_sk Int64,
  d_date_id String,
  d_date date,
  d_month_seq Nullable(Int64),
  d_week_seq Nullable(Int64),
  d_quarter_seq Nullable(Int64),
  d_year Nullable(Int64),
  d_dow Nullable(Int64),
  d_moy Nullable(Int64),
  d_dom Nullable(Int64),
  d_qoy Nullable(Int64),
  d_fy_year Nullable(Int64),
  d_fy_quarter_seq Nullable(Int64),
  d_fy_week_seq Nullable(Int64),
  d_day_name Nullable(String),
  d_quarter_name Nullable(String),
  d_holiday Nullable(String),
  d_weekend Nullable(String),
  d_following_holiday Nullable(String),
  d_first_dom Nullable(Int64),
  d_last_dom Nullable(Int64),
  d_same_day_ly Nullable(Int64),
  d_same_day_lq Nullable(Int64),
  d_current_day Nullable(String),
  d_current_week Nullable(String),
  d_current_month Nullable(String),
  d_current_quarter Nullable(String),
  d_current_year Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY d_date_sk INTO 128 BUCKETS
ORDER BY d_date_sk;
create table household_demographics (
  hd_demo_sk Int64,
  hd_income_band_sk Nullable(Int64),
  hd_buy_potential Nullable(String),
  hd_dep_count Nullable(Int64),
  hd_vehicle_count Nullable(Int64)
) ENGINE = CnchMergeTree() CLUSTER BY hd_demo_sk INTO 128 BUCKETS
ORDER BY hd_demo_sk;
create table income_band (
  ib_income_band_sk Int64,
  ib_lower_bound Nullable(Int64),
  ib_upper_bound Nullable(Int64)
) ENGINE = CnchMergeTree() CLUSTER BY ib_income_band_sk INTO 128 BUCKETS
ORDER BY ib_income_band_sk;
create table item (
  i_item_sk Int64,
  i_item_id String,
  i_rec_start_date Nullable(date),
  i_rec_end_date Nullable(date),
  i_item_desc Nullable(String),
  i_current_price Nullable(Float64),
  i_wholesale_cost Nullable(Float64),
  i_brand_id Nullable(Int64),
  i_brand Nullable(String),
  i_class_id Nullable(Int64),
  i_class Nullable(String),
  i_category_id Nullable(Int64),
  i_category Nullable(String),
  i_manufact_id Nullable(Int64),
  i_manufact Nullable(String),
  i_size Nullable(String),
  i_formulation Nullable(String),
  i_color Nullable(String),
  i_units Nullable(String),
  i_container Nullable(String),
  i_manager_id Nullable(Int64),
  i_product_name Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY i_item_sk INTO 128 BUCKETS
ORDER BY i_item_sk;
create table promotion (
  p_promo_sk Int64,
  p_promo_id String,
  p_start_date_sk Nullable(Int64),
  p_end_date_sk Nullable(Int64),
  p_item_sk Nullable(Int64),
  p_cost Nullable(Float64),
  p_response_target Nullable(Int64),
  p_promo_name Nullable(String),
  p_channel_dmail Nullable(String),
  p_channel_email Nullable(String),
  p_channel_catalog Nullable(String),
  p_channel_tv Nullable(String),
  p_channel_radio Nullable(String),
  p_channel_press Nullable(String),
  p_channel_event Nullable(String),
  p_channel_demo Nullable(String),
  p_channel_details Nullable(String),
  p_purpose Nullable(String),
  p_discount_active Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY p_promo_sk INTO 128 BUCKETS
ORDER BY p_promo_sk;
create table reason (
  r_reason_sk Int64,
  r_reason_id String,
  r_reason_desc Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY r_reason_sk INTO 128 BUCKETS
ORDER BY r_reason_sk;
create table ship_mode (
  sm_ship_mode_sk Int64,
  sm_ship_mode_id String,
  sm_type Nullable(String),
  sm_code Nullable(String),
  sm_carrier Nullable(String),
  sm_contract Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY sm_ship_mode_sk INTO 128 BUCKETS
ORDER BY sm_ship_mode_sk;
create table store (
  s_store_sk Int64,
  s_store_id String,
  s_rec_start_date Nullable(date),
  s_rec_end_date Nullable(date),
  s_closed_date_sk Nullable(Int64),
  s_store_name Nullable(String),
  s_number_employees Nullable(Int64),
  s_floor_space Nullable(Int64),
  s_hours Nullable(String),
  s_manager Nullable(String),
  s_market_id Nullable(Int64),
  s_geography_class Nullable(String),
  s_market_desc Nullable(String),
  s_market_manager Nullable(String),
  s_division_id Nullable(Int64),
  s_division_name Nullable(String),
  s_company_id Nullable(Int64),
  s_company_name Nullable(String),
  s_street_number Nullable(String),
  s_street_name Nullable(String),
  s_street_type Nullable(String),
  s_suite_number Nullable(String),
  s_city Nullable(String),
  s_county Nullable(String),
  s_state Nullable(String),
  s_zip Nullable(String),
  s_country Nullable(String),
  s_gmt_offset Nullable(Float64),
  s_tax_percentage Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY s_store_sk INTO 128 BUCKETS
ORDER BY s_store_sk;
create table time_dim (
  t_time_sk Int64,
  t_time_id String,
  t_time Int64,
  t_hour Nullable(Int64),
  t_minute Nullable(Int64),
  t_second Nullable(Int64),
  t_am_pm Nullable(String),
  t_shift Nullable(String),
  t_sub_shift Nullable(String),
  t_meal_time Nullable(String)
) ENGINE = CnchMergeTree() CLUSTER BY t_time_sk INTO 128 BUCKETS
ORDER BY t_time_sk;
create table warehouse (
  w_warehouse_sk Int64,
  w_warehouse_id String,
  w_warehouse_name Nullable(String),
  w_warehouse_sq_ft Nullable(Int64),
  w_street_number Nullable(String),
  w_street_name Nullable(String),
  w_street_type Nullable(String),
  w_suite_number Nullable(String),
  w_city Nullable(String),
  w_county Nullable(String),
  w_state Nullable(String),
  w_zip Nullable(String),
  w_country Nullable(String),
  w_gmt_offset Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY w_warehouse_sk INTO 128 BUCKETS
ORDER BY w_warehouse_sk;
create table web_page (
  wp_web_page_sk Int64,
  wp_web_page_id String,
  wp_rec_start_date Nullable(date),
  wp_rec_end_date Nullable(date),
  wp_creation_date_sk Nullable(Int64),
  wp_access_date_sk Nullable(Int64),
  wp_autogen_flag Nullable(String),
  wp_customer_sk Nullable(Int64),
  wp_url Nullable(String),
  wp_type Nullable(String),
  wp_char_count Nullable(Int64),
  wp_link_count Nullable(Int64),
  wp_image_count Nullable(Int64),
  wp_max_ad_count Nullable(Int64)
) ENGINE = CnchMergeTree() CLUSTER BY wp_web_page_sk INTO 128 BUCKETS
ORDER BY wp_web_page_sk;
create table web_site (
  web_site_sk Int64,
  web_site_id String,
  web_rec_start_date Nullable(date),
  web_rec_end_date Nullable(date),
  web_name Nullable(String),
  web_open_date_sk Nullable(Int64),
  web_close_date_sk Nullable(Int64),
  web_class Nullable(String),
  web_manager Nullable(String),
  web_mkt_id Nullable(Int64),
  web_mkt_class Nullable(String),
  web_mkt_desc Nullable(String),
  web_market_manager Nullable(String),
  web_company_id Nullable(Int64),
  web_company_name Nullable(String),
  web_street_number Nullable(String),
  web_street_name Nullable(String),
  web_street_type Nullable(String),
  web_suite_number Nullable(String),
  web_city Nullable(String),
  web_county Nullable(String),
  web_state Nullable(String),
  web_zip Nullable(String),
  web_country Nullable(String),
  web_gmt_offset Nullable(Float64),
  web_tax_percentage Nullable(Float64)
) ENGINE = CnchMergeTree() CLUSTER BY web_site_sk INTO 128 BUCKETS
ORDER BY web_site_sk;