Skip to content

Commit

Permalink
TPC-DS: Schema and queries updated
Browse files Browse the repository at this point in the history
  • Loading branch information
perdelt committed Nov 6, 2024
1 parent 46efe6d commit af888be
Show file tree
Hide file tree
Showing 5 changed files with 415 additions and 135 deletions.
11 changes: 10 additions & 1 deletion docs/Example-TPC-DS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ This example shows how to benchmark 99 reading queries Q1-Q99 derived from TPC-D
> The query file is derived from the TPC-DS and as such is not comparable to published TPC-DS results, as the query file results do not comply with the TPC-DS Specification.
In particular we had to apply changes, because
* MySQL and MariaDB do not have a FULL OUTER JOIN
* MySQL and MariaDB do not have a FULL OUTER JOIN (Q51, Q97)
* MySQL and MariaDB do CASTing to INTEGER differently
* column names may differ if AS is not used explicitly
* MariaDB does not know GROUPING

The schema of
* MonetDB: sets primary keys and foreign key constraints after import and no other indexes
* MySQL: sets primary keys before import, all foreign key constraints and indexes on foreign keys of fact tables and customer table after import
* MariaDB: sets primary keys before import, all foreign key constraints and indexes on foreign keys of fact tables and customer table after import
* PostgreSQL: sets primary keys before import, all foreign key constraints and indexes on foreign keys of fact tables and customer table after import


See [query file](https://github.com/Beuth-Erdelt/Benchmark-Experiment-Host-Manager/blob/master/experiments/tpcds/queries-tpcds.config) for all details.

Expand Down
51 changes: 51 additions & 0 deletions experiments/tpcds/MariaDB/initindexes-tpcds.sql
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@

-- Store Sales Fact Table
CREATE INDEX idx_store_sales_customer_id ON store_sales (ss_customer_sk);
CREATE INDEX idx_store_sales_item_id ON store_sales (ss_item_sk);
CREATE INDEX idx_store_sales_promo_id ON store_sales (ss_promo_sk);
CREATE INDEX idx_store_sales_store_id ON store_sales (ss_store_sk);
CREATE INDEX idx_store_sales_date_id ON store_sales (ss_sold_date_sk);

-- Catalog Sales Fact Table
CREATE INDEX idx_catalog_sales_customer_id ON catalog_sales (cs_bill_customer_sk);
CREATE INDEX idx_catalog_sales_ship_customer_id ON catalog_sales (cs_ship_customer_sk);
CREATE INDEX idx_catalog_sales_item_id ON catalog_sales (cs_item_sk);
CREATE INDEX idx_catalog_sales_promo_id ON catalog_sales (cs_promo_sk);
CREATE INDEX idx_catalog_sales_warehouse_id ON catalog_sales (cs_warehouse_sk);
CREATE INDEX idx_catalog_sales_date_id ON catalog_sales (cs_sold_date_sk);

-- Web Sales Fact Table
CREATE INDEX idx_web_sales_customer_id ON web_sales (ws_bill_customer_sk);
CREATE INDEX idx_web_sales_ship_customer_id ON web_sales (ws_ship_customer_sk);
CREATE INDEX idx_web_sales_item_id ON web_sales (ws_item_sk);
CREATE INDEX idx_web_sales_promo_id ON web_sales (ws_promo_sk);
CREATE INDEX idx_web_sales_warehouse_id ON web_sales (ws_warehouse_sk);
CREATE INDEX idx_web_sales_date_id ON web_sales (ws_sold_date_sk);

-- Inventory Fact Table
CREATE INDEX idx_inventory_item_id ON inventory (inv_item_sk);
CREATE INDEX idx_inventory_warehouse_id ON inventory (inv_warehouse_sk);
CREATE INDEX idx_inventory_date_id ON inventory (inv_date_sk);

-- Customer Address Table (for customer relationships)
CREATE INDEX idx_customer_address_id ON customer (c_current_addr_sk);
CREATE INDEX idx_customer_birth_country ON customer (c_birth_country);

-- Store Returns Table
CREATE INDEX idx_store_returns_customer_id ON store_returns (sr_customer_sk);
CREATE INDEX idx_store_returns_item_id ON store_returns (sr_item_sk);
CREATE INDEX idx_store_returns_date_id ON store_returns (sr_returned_date_sk);
CREATE INDEX idx_store_returns_ticket_id ON store_returns (sr_ticket_number);
CREATE INDEX idx_store_returns_store_id ON store_returns (sr_store_sk);

-- Catalog Returns Table
CREATE INDEX idx_catalog_returns_customer_id ON catalog_returns (cr_returning_customer_sk);
CREATE INDEX idx_catalog_returns_item_id ON catalog_returns (cr_item_sk);
CREATE INDEX idx_catalog_returns_date_id ON catalog_returns (cr_returned_date_sk);
CREATE INDEX idx_catalog_returns_order_number ON catalog_returns (cr_order_number);
CREATE INDEX idx_catalog_returns_warehouse_id ON catalog_returns (cr_warehouse_sk);

-- Web Returns Table
CREATE INDEX idx_web_returns_customer_id ON web_returns (wr_returning_customer_sk);
CREATE INDEX idx_web_returns_item_id ON web_returns (wr_item_sk);
CREATE INDEX idx_web_returns_date_id ON web_returns (wr_returned_date_sk);
CREATE INDEX idx_web_returns_order_number ON web_returns (wr_order_number);
51 changes: 51 additions & 0 deletions experiments/tpcds/MySQL/initindexes-tpcds.sql
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@

-- Store Sales Fact Table
CREATE INDEX idx_store_sales_customer_id ON store_sales (ss_customer_sk);
CREATE INDEX idx_store_sales_item_id ON store_sales (ss_item_sk);
CREATE INDEX idx_store_sales_promo_id ON store_sales (ss_promo_sk);
CREATE INDEX idx_store_sales_store_id ON store_sales (ss_store_sk);
CREATE INDEX idx_store_sales_date_id ON store_sales (ss_sold_date_sk);

-- Catalog Sales Fact Table
CREATE INDEX idx_catalog_sales_customer_id ON catalog_sales (cs_bill_customer_sk);
CREATE INDEX idx_catalog_sales_ship_customer_id ON catalog_sales (cs_ship_customer_sk);
CREATE INDEX idx_catalog_sales_item_id ON catalog_sales (cs_item_sk);
CREATE INDEX idx_catalog_sales_promo_id ON catalog_sales (cs_promo_sk);
CREATE INDEX idx_catalog_sales_warehouse_id ON catalog_sales (cs_warehouse_sk);
CREATE INDEX idx_catalog_sales_date_id ON catalog_sales (cs_sold_date_sk);

-- Web Sales Fact Table
CREATE INDEX idx_web_sales_customer_id ON web_sales (ws_bill_customer_sk);
CREATE INDEX idx_web_sales_ship_customer_id ON web_sales (ws_ship_customer_sk);
CREATE INDEX idx_web_sales_item_id ON web_sales (ws_item_sk);
CREATE INDEX idx_web_sales_promo_id ON web_sales (ws_promo_sk);
CREATE INDEX idx_web_sales_warehouse_id ON web_sales (ws_warehouse_sk);
CREATE INDEX idx_web_sales_date_id ON web_sales (ws_sold_date_sk);

-- Inventory Fact Table
CREATE INDEX idx_inventory_item_id ON inventory (inv_item_sk);
CREATE INDEX idx_inventory_warehouse_id ON inventory (inv_warehouse_sk);
CREATE INDEX idx_inventory_date_id ON inventory (inv_date_sk);

-- Customer Address Table (for customer relationships)
CREATE INDEX idx_customer_address_id ON customer (c_current_addr_sk);
CREATE INDEX idx_customer_birth_country ON customer (c_birth_country);

-- Store Returns Table
CREATE INDEX idx_store_returns_customer_id ON store_returns (sr_customer_sk);
CREATE INDEX idx_store_returns_item_id ON store_returns (sr_item_sk);
CREATE INDEX idx_store_returns_date_id ON store_returns (sr_returned_date_sk);
CREATE INDEX idx_store_returns_ticket_id ON store_returns (sr_ticket_number);
CREATE INDEX idx_store_returns_store_id ON store_returns (sr_store_sk);

-- Catalog Returns Table
CREATE INDEX idx_catalog_returns_customer_id ON catalog_returns (cr_returning_customer_sk);
CREATE INDEX idx_catalog_returns_item_id ON catalog_returns (cr_item_sk);
CREATE INDEX idx_catalog_returns_date_id ON catalog_returns (cr_returned_date_sk);
CREATE INDEX idx_catalog_returns_order_number ON catalog_returns (cr_order_number);
CREATE INDEX idx_catalog_returns_warehouse_id ON catalog_returns (cr_warehouse_sk);

-- Web Returns Table
CREATE INDEX idx_web_returns_customer_id ON web_returns (wr_returning_customer_sk);
CREATE INDEX idx_web_returns_item_id ON web_returns (wr_item_sk);
CREATE INDEX idx_web_returns_date_id ON web_returns (wr_returned_date_sk);
CREATE INDEX idx_web_returns_order_number ON web_returns (wr_order_number);
51 changes: 51 additions & 0 deletions experiments/tpcds/PostgreSQL/initindexes-tpcds.sql
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@

-- Store Sales Fact Table
CREATE INDEX idx_store_sales_customer_id ON store_sales (ss_customer_sk);
CREATE INDEX idx_store_sales_item_id ON store_sales (ss_item_sk);
CREATE INDEX idx_store_sales_promo_id ON store_sales (ss_promo_sk);
CREATE INDEX idx_store_sales_store_id ON store_sales (ss_store_sk);
CREATE INDEX idx_store_sales_date_id ON store_sales (ss_sold_date_sk);

-- Catalog Sales Fact Table
CREATE INDEX idx_catalog_sales_customer_id ON catalog_sales (cs_bill_customer_sk);
CREATE INDEX idx_catalog_sales_ship_customer_id ON catalog_sales (cs_ship_customer_sk);
CREATE INDEX idx_catalog_sales_item_id ON catalog_sales (cs_item_sk);
CREATE INDEX idx_catalog_sales_promo_id ON catalog_sales (cs_promo_sk);
CREATE INDEX idx_catalog_sales_warehouse_id ON catalog_sales (cs_warehouse_sk);
CREATE INDEX idx_catalog_sales_date_id ON catalog_sales (cs_sold_date_sk);

-- Web Sales Fact Table
CREATE INDEX idx_web_sales_customer_id ON web_sales (ws_bill_customer_sk);
CREATE INDEX idx_web_sales_ship_customer_id ON web_sales (ws_ship_customer_sk);
CREATE INDEX idx_web_sales_item_id ON web_sales (ws_item_sk);
CREATE INDEX idx_web_sales_promo_id ON web_sales (ws_promo_sk);
CREATE INDEX idx_web_sales_warehouse_id ON web_sales (ws_warehouse_sk);
CREATE INDEX idx_web_sales_date_id ON web_sales (ws_sold_date_sk);

-- Inventory Fact Table
CREATE INDEX idx_inventory_item_id ON inventory (inv_item_sk);
CREATE INDEX idx_inventory_warehouse_id ON inventory (inv_warehouse_sk);
CREATE INDEX idx_inventory_date_id ON inventory (inv_date_sk);

-- Customer Address Table (for customer relationships)
CREATE INDEX idx_customer_address_id ON customer (c_current_addr_sk);
CREATE INDEX idx_customer_birth_country ON customer (c_birth_country);

-- Store Returns Table
CREATE INDEX idx_store_returns_customer_id ON store_returns (sr_customer_sk);
CREATE INDEX idx_store_returns_item_id ON store_returns (sr_item_sk);
CREATE INDEX idx_store_returns_date_id ON store_returns (sr_returned_date_sk);
CREATE INDEX idx_store_returns_ticket_id ON store_returns (sr_ticket_number);
CREATE INDEX idx_store_returns_store_id ON store_returns (sr_store_sk);

-- Catalog Returns Table
CREATE INDEX idx_catalog_returns_customer_id ON catalog_returns (cr_returning_customer_sk);
CREATE INDEX idx_catalog_returns_item_id ON catalog_returns (cr_item_sk);
CREATE INDEX idx_catalog_returns_date_id ON catalog_returns (cr_returned_date_sk);
CREATE INDEX idx_catalog_returns_order_number ON catalog_returns (cr_order_number);
CREATE INDEX idx_catalog_returns_warehouse_id ON catalog_returns (cr_warehouse_sk);

-- Web Returns Table
CREATE INDEX idx_web_returns_customer_id ON web_returns (wr_returning_customer_sk);
CREATE INDEX idx_web_returns_item_id ON web_returns (wr_item_sk);
CREATE INDEX idx_web_returns_date_id ON web_returns (wr_returned_date_sk);
CREATE INDEX idx_web_returns_order_number ON web_returns (wr_order_number);
Loading

0 comments on commit af888be

Please sign in to comment.