Skip to content

Commit

Permalink
TPC-DS: Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
perdelt committed Nov 7, 2024
1 parent 58cd74a commit b305a32
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 46 deletions.
72 changes: 36 additions & 36 deletions experiments/tpcds/MySQL/initindexes-tpcds.sql
Original file line number Diff line number Diff line change
@@ -1,52 +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);
CREATE INDEX idx_store_sales_customer_id ON tpcds.store_sales (ss_customer_sk);
CREATE INDEX idx_store_sales_item_id ON tpcds.store_sales (ss_item_sk);
CREATE INDEX idx_store_sales_promo_id ON tpcds.store_sales (ss_promo_sk);
CREATE INDEX idx_store_sales_store_id ON tpcds.store_sales (ss_store_sk);
CREATE INDEX idx_store_sales_date_id ON tpcds.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);
CREATE INDEX idx_catalog_sales_customer_id ON tpcds.catalog_sales (cs_bill_customer_sk);
CREATE INDEX idx_catalog_sales_ship_customer_id ON tpcds.catalog_sales (cs_ship_customer_sk);
CREATE INDEX idx_catalog_sales_item_id ON tpcds.catalog_sales (cs_item_sk);
CREATE INDEX idx_catalog_sales_promo_id ON tpcds.catalog_sales (cs_promo_sk);
CREATE INDEX idx_catalog_sales_warehouse_id ON tpcds.catalog_sales (cs_warehouse_sk);
CREATE INDEX idx_catalog_sales_date_id ON tpcds.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);
CREATE INDEX idx_web_sales_customer_id ON tpcds.web_sales (ws_bill_customer_sk);
CREATE INDEX idx_web_sales_ship_customer_id ON tpcds.web_sales (ws_ship_customer_sk);
CREATE INDEX idx_web_sales_item_id ON tpcds.web_sales (ws_item_sk);
CREATE INDEX idx_web_sales_promo_id ON tpcds.web_sales (ws_promo_sk);
CREATE INDEX idx_web_sales_warehouse_id ON tpcds.web_sales (ws_warehouse_sk);
CREATE INDEX idx_web_sales_date_id ON tpcds.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);
CREATE INDEX idx_inventory_item_id ON tpcds.inventory (inv_item_sk);
CREATE INDEX idx_inventory_warehouse_id ON tpcds.inventory (inv_warehouse_sk);
CREATE INDEX idx_inventory_date_id ON tpcds.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);
CREATE INDEX idx_customer_address_id ON tpcds.customer (c_current_addr_sk);
CREATE INDEX idx_customer_birth_country ON tpcds.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);
CREATE INDEX idx_store_returns_customer_id ON tpcds.store_returns (sr_customer_sk);
CREATE INDEX idx_store_returns_item_id ON tpcds.store_returns (sr_item_sk);
CREATE INDEX idx_store_returns_date_id ON tpcds.store_returns (sr_returned_date_sk);
CREATE INDEX idx_store_returns_ticket_id ON tpcds.store_returns (sr_ticket_number);
CREATE INDEX idx_store_returns_store_id ON tpcds.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);
CREATE INDEX idx_catalog_returns_customer_id ON tpcds.catalog_returns (cr_returning_customer_sk);
CREATE INDEX idx_catalog_returns_item_id ON tpcds.catalog_returns (cr_item_sk);
CREATE INDEX idx_catalog_returns_date_id ON tpcds.catalog_returns (cr_returned_date_sk);
CREATE INDEX idx_catalog_returns_order_number ON tpcds.catalog_returns (cr_order_number);
CREATE INDEX idx_catalog_returns_warehouse_id ON tpcds.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);
CREATE INDEX idx_web_returns_customer_id ON tpcds.web_returns (wr_returning_customer_sk);
CREATE INDEX idx_web_returns_item_id ON tpcds.web_returns (wr_item_sk);
CREATE INDEX idx_web_returns_date_id ON tpcds.web_returns (wr_returned_date_sk);
CREATE INDEX idx_web_returns_order_number ON tpcds.web_returns (wr_order_number);
17 changes: 9 additions & 8 deletions experiments/tpcds/queries-tpcds.config
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@
{
'title': "TPC-DS Q8",
'query': """ select s_store_name
,sum(ss_net_profit)
,sum(ss_net_profit) as sum_net_profit
from store_sales
,date_dim
,store,
Expand Down Expand Up @@ -3121,7 +3121,7 @@
{
'title': "TPC-DS Q15",
'query': """ select ca_zip
,sum(cs_sales_price)
,sum(cs_sales_price) as sum_sales_prices
from catalog_sales
,customer
,customer_address
Expand Down Expand Up @@ -5154,7 +5154,7 @@
},
{
'title': "TPC-DS Q38",
'query': """select count(*) from (
'query': """select count(*) as counter from (
select distinct c_last_name, c_first_name, d_date
from store_sales, date_dim, customer
where store_sales.ss_sold_date_sk = date_dim.d_date_sk
Expand Down Expand Up @@ -5440,7 +5440,7 @@
'query': """ select dt.d_year
,item.i_category_id
,item.i_category
,sum(ss_ext_sales_price)
,sum(ss_ext_sales_price) as sum_sales_price
from date_dim dt
,store_sales
,item
Expand Down Expand Up @@ -5603,7 +5603,7 @@
},
{
'title': "TPC-DS Q45",
'query': """ select ca_zip, {GBOBC}, sum(ws_sales_price)
'query': """ select ca_zip, {GBOBC}, sum(ws_sales_price) as sum_sales_prices
from web_sales, customer, customer_address, date_dim, item
where ws_bill_customer_sk = c_customer_sk
and c_current_addr_sk = ca_address_sk
Expand Down Expand Up @@ -5820,7 +5820,7 @@
},
{
'title': "TPC-DS Q48",
'query': """select sum(ss_quantity)
'query': """select sum(ss_quantity) as sum_quantity
from store_sales, store, customer_demographics, customer_address, date_dim
where s_store_sk = ss_store_sk
and ss_sold_date_sk = d_date_sk and d_year = {YEAR}
Expand Down Expand Up @@ -6912,7 +6912,8 @@ LIMIT 100"""
)
select s_store_name1,s_store_id1,d_week_seq1
,sun_sales1/sun_sales2 sun_sales, mon_sales1/mon_sales2 mon_sales
,tue_sales1/tue_sales2 tue_sales, wed_sales1/wed_sales2,thu_sales1/thu_sales2 thu_sales
,tue_sales1/tue_sales2 tue_sales, wed_sales1/wed_sales2 wed_sales
,thu_sales1/thu_sales2 thu_sales
,fri_sales1/fri_sales2 fri_sales, sat_sales1/sat_sales2 sat_sales
from
(select s_store_name s_store_name1,wss.d_week_seq d_week_seq1
Expand Down Expand Up @@ -7082,7 +7083,7 @@ LIMIT 100"""
},
{
'title': "TPC-DS Q61",
'query': """ select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100
'query': """ select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 prom_per_total
from
(select sum(ss_ext_sales_price) promotions
from store_sales
Expand Down
4 changes: 2 additions & 2 deletions images/tpcds/loader_mysql/loader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ for i in *.dat; do
for ((j=1;j<=$NUM_PODS;j++));
do
#echo $j
if [ -f "$destination_raw/../$j/$basename.tbl.$j" ]
if [ -f "$destination_raw/../$j/$basename_$j_$NUM_PODS.dat" ]
then
file="'$destination_raw/../$j/$basename.tbl.$j',"
file="'$destination_raw/../$j/$basename_$j_$NUM_PODS.dat',"
COMMAND=$COMMAND$file
fi
done
Expand Down

0 comments on commit b305a32

Please sign in to comment.