Skip to content

Commit 320c848

Browse files
Improve stress test
1 parent ee24bd4 commit 320c848

File tree

3 files changed

+113
-85
lines changed

3 files changed

+113
-85
lines changed

run_tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ if [ -f regression.diffs ]; then cat regression.diffs; fi
146146
set +x -e
147147
virtualenv /tmp/env && source /tmp/env/bin/activate
148148
pip install PyYAML
149+
pip install psycopg2
149150
pip install testgres
151+
pip install progressbar2
150152
set -e #exit virtualenv with error code
151153
if [ "$LEVEL" = "stress" ]; then
152154
python tests/pg_qs_test_runner.py --stress

tests/query_tpcds.sql

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ with ssr as
248248
store
249249
where date_sk = d_date_sk
250250
and d_date between cast('2000-08-19' as date)
251-
and (cast('2000-08-19' as date) + 14 days)
251+
and (cast('2000-08-19' as date) + interval '14 days')
252252
and store_sk = s_store_sk
253253
group by s_store_id)
254254
,
@@ -279,7 +279,7 @@ with ssr as
279279
catalog_page
280280
where date_sk = d_date_sk
281281
and d_date between cast('2000-08-19' as date)
282-
and (cast('2000-08-19' as date) + 14 days)
282+
and (cast('2000-08-19' as date) + interval '14 days')
283283
and page_sk = cp_catalog_page_sk
284284
group by cp_catalog_page_id)
285285
,
@@ -312,7 +312,7 @@ with ssr as
312312
web_site
313313
where date_sk = d_date_sk
314314
and d_date between cast('2000-08-19' as date)
315-
and (cast('2000-08-19' as date) + 14 days)
315+
and (cast('2000-08-19' as date) + interval '14 days')
316316
and wsr_web_site_sk = web_site_sk
317317
group by web_site_id)
318318
select channel
@@ -712,7 +712,7 @@ where
712712
and i_category in ('Men', 'Books', 'Electronics')
713713
and ws_sold_date_sk = d_date_sk
714714
and d_date between cast('2001-06-15' as date)
715-
and (cast('2001-06-15' as date) + 30 days)
715+
and (cast('2001-06-15' as date) + interval '30 days')
716716
group by
717717
i_item_id
718718
,i_item_desc
@@ -812,7 +812,7 @@ with cross_items as
812812
,date_dim d3
813813
where ws_item_sk = iws.i_item_sk
814814
and ws_sold_date_sk = d3.d_date_sk
815-
and d3.d_year between 1999 AND 1999 + 2)
815+
and d3.d_year between 1999 AND 1999 + 2) as sub
816816
where i_brand_id = brand_id
817817
and i_class_id = class_id
818818
and i_category_id = category_id
@@ -838,7 +838,7 @@ with cross_items as
838838
from web_sales
839839
,date_dim
840840
where ws_sold_date_sk = d_date_sk
841-
and d_year between 1999 and 1999 + 2) x)
841+
and d_year between 1999 and 1999 + 2) as x)
842842
select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales)
843843
from(
844844
select 'store' channel, i_brand_id,i_class_id
@@ -882,6 +882,7 @@ with cross_items as
882882
group by rollup (channel, i_brand_id,i_class_id,i_category_id)
883883
order by channel,i_brand_id,i_class_id,i_category_id
884884
limit 100;
885+
885886
with cross_items as
886887
(select i_item_sk ss_item_sk
887888
from item,
@@ -913,7 +914,7 @@ with cross_items as
913914
,date_dim d3
914915
where ws_item_sk = iws.i_item_sk
915916
and ws_sold_date_sk = d3.d_date_sk
916-
and d3.d_year between 1999 AND 1999 + 2) x
917+
and d3.d_year between 1999 AND 1999 + 2) as x
917918
where i_brand_id = brand_id
918919
and i_class_id = class_id
919920
and i_category_id = category_id
@@ -939,7 +940,7 @@ with cross_items as
939940
from web_sales
940941
,date_dim
941942
where ws_sold_date_sk = d_date_sk
942-
and d_year between 1999 and 1999 + 2) x)
943+
and d_year between 1999 and 1999 + 2) as x)
943944
select this_year.channel ty_channel
944945
,this_year.i_brand_id ty_brand
945946
,this_year.i_class_id ty_class
@@ -1022,7 +1023,7 @@ from
10221023
,call_center
10231024
where
10241025
d_date between '2002-4-01' and
1025-
(cast('2002-4-01' as date) + 60 days)
1026+
(cast('2002-4-01' as date) + interval '60 days')
10261027
and cs1.cs_ship_date_sk = d_date_sk
10271028
and cs1.cs_ship_addr_sk = ca_address_sk
10281029
and ca_state = 'PA'
@@ -1161,7 +1162,7 @@ select i_item_id
11611162
and i_category in ('Books', 'Music', 'Sports')
11621163
and cs_sold_date_sk = d_date_sk
11631164
and d_date between cast('2002-06-18' as date)
1164-
and (cast('2002-06-18' as date) + 30 days)
1165+
and (cast('2002-06-18' as date) + interval '30 days')
11651166
group by i_item_id
11661167
,i_item_desc
11671168
,i_category
@@ -1193,8 +1194,8 @@ select *
11931194
and i_item_sk = inv_item_sk
11941195
and inv_warehouse_sk = w_warehouse_sk
11951196
and inv_date_sk = d_date_sk
1196-
and d_date between (cast ('1999-06-22' as date) - 30 days)
1197-
and (cast ('1999-06-22' as date) + 30 days)
1197+
and d_date between (cast ('1999-06-22' as date) - interval '30 days')
1198+
and (cast ('1999-06-22' as date) + interval '30 days')
11981199
group by w_warehouse_name, i_item_id) x
11991200
where (case when inv_before > 0
12001201
then inv_after / inv_before
@@ -1238,14 +1239,15 @@ with frequent_ss_items as
12381239
having count(*) >4),
12391240
max_store_sales as
12401241
(select max(csales) tpcds_cmax
1241-
from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales
1242+
from (select c_customer_sk,sum(ss_quantity*ss_sales_price) as csales
12421243
from store_sales
12431244
,customer
12441245
,date_dim
12451246
where ss_customer_sk = c_customer_sk
12461247
and ss_sold_date_sk = d_date_sk
12471248
and d_year in (2000,2000+1,2000+2,2000+3)
1248-
group by c_customer_sk)),
1249+
group by c_customer_sk) as scsales
1250+
),
12491251
best_ss_customer as
12501252
(select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales
12511253
from store_sales
@@ -1273,8 +1275,9 @@ from
12731275
and d_moy = 7
12741276
and ws_sold_date_sk = d_date_sk
12751277
and ws_item_sk in (select item_sk from frequent_ss_items)
1276-
and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer))
1278+
and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) as foo
12771279
limit 100;
1280+
12781281
with frequent_ss_items as
12791282
(select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
12801283
from store_sales
@@ -1294,7 +1297,7 @@ with frequent_ss_items as
12941297
where ss_customer_sk = c_customer_sk
12951298
and ss_sold_date_sk = d_date_sk
12961299
and d_year in (2000,2000+1,2000+2,2000+3)
1297-
group by c_customer_sk)),
1300+
group by c_customer_sk) as scsales),
12981301
best_ss_customer as
12991302
(select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales
13001303
from store_sales
@@ -1327,7 +1330,7 @@ with frequent_ss_items as
13271330
and ws_item_sk in (select item_sk from frequent_ss_items)
13281331
and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)
13291332
and ws_bill_customer_sk = c_customer_sk
1330-
group by c_last_name,c_first_name)
1333+
group by c_last_name,c_first_name) as sub
13311334
order by c_last_name,c_first_name,sales
13321335
limit 100;
13331336

@@ -1724,7 +1727,7 @@ where
17241727
i_manufact_id = 722
17251728
and i_item_sk = cs_item_sk
17261729
and d_date between '2001-03-09' and
1727-
(cast('2001-03-09' as date) + 90 days)
1730+
(cast('2001-03-09' as date) + interval '90 days')
17281731
and d_date_sk = cs_sold_date_sk
17291732
and cs_ext_discount_amt
17301733
> (
@@ -1736,7 +1739,7 @@ and cs_ext_discount_amt
17361739
where
17371740
cs_item_sk = i_item_sk
17381741
and d_date between '2001-03-09' and
1739-
(cast('2001-03-09' as date) + 90 days)
1742+
(cast('2001-03-09' as date) + interval '90 days')
17401743
and d_date_sk = cs_sold_date_sk
17411744
)
17421745
limit 100;
@@ -1944,7 +1947,7 @@ select i_item_id
19441947
where i_current_price between 29 and 29 + 30
19451948
and inv_item_sk = i_item_sk
19461949
and d_date_sk=inv_date_sk
1947-
and d_date between cast('2002-03-29' as date) and (cast('2002-03-29' as date) + 60 days)
1950+
and d_date between cast('2002-03-29' as date) and (cast('2002-03-29' as date) + interval '60 days')
19481951
and i_manufact_id in (705,742,777,944)
19491952
and inv_quantity_on_hand between 100 and 500
19501953
and cs_item_sk = i_item_sk
@@ -2050,8 +2053,8 @@ select
20502053
and i_item_sk = cs_item_sk
20512054
and cs_warehouse_sk = w_warehouse_sk
20522055
and cs_sold_date_sk = d_date_sk
2053-
and d_date between (cast ('2001-05-02' as date) - 30 days)
2054-
and (cast ('2001-05-02' as date) + 30 days)
2056+
and d_date between (cast ('2001-05-02' as date) - interval '30 days')
2057+
and (cast ('2001-05-02' as date) + interval '30 days')
20552058
group by
20562059
w_state,i_item_id
20572060
order by w_state,i_item_id
@@ -2395,7 +2398,7 @@ select channel, item, return_ratio, return_rank, currency_rank from
23952398
and d_moy = 11
23962399
group by ws.ws_item_sk
23972400
) in_web
2398-
) web
2401+
) as web
23992402
where
24002403
(
24012404
web.return_rank <= 10
@@ -2438,7 +2441,7 @@ select channel, item, return_ratio, return_rank, currency_rank from
24382441
and d_moy = 11
24392442
group by cs.cs_item_sk
24402443
) in_cat
2441-
) catalog
2444+
) as catalog
24422445
where
24432446
(
24442447
catalog.return_rank <= 10
@@ -2477,13 +2480,13 @@ select channel, item, return_ratio, return_rank, currency_rank from
24772480
and d_moy = 11
24782481
group by sts.ss_item_sk
24792482
) in_store
2480-
) store
2483+
) as store
24812484
where (
24822485
store.return_rank <= 10
24832486
or
24842487
store.currency_rank <= 10
24852488
)
2486-
)
2489+
)as tab
24872490
order by 1,4,5,2
24882491
limit 100;
24892492

@@ -3927,7 +3930,7 @@ with ss as
39273930
store
39283931
where ss_sold_date_sk = d_date_sk
39293932
and d_date between cast('2000-08-10' as date)
3930-
and (cast('2000-08-10' as date) + 30 days)
3933+
and (cast('2000-08-10' as date) + interval '30 days')
39313934
and ss_store_sk = s_store_sk
39323935
group by s_store_sk)
39333936
,
@@ -3940,7 +3943,7 @@ with ss as
39403943
store
39413944
where sr_returned_date_sk = d_date_sk
39423945
and d_date between cast('2000-08-10' as date)
3943-
and (cast('2000-08-10' as date) + 30 days)
3946+
and (cast('2000-08-10' as date) + interval '30 days')
39443947
and sr_store_sk = s_store_sk
39453948
group by s_store_sk),
39463949
cs as
@@ -3951,7 +3954,7 @@ with ss as
39513954
date_dim
39523955
where cs_sold_date_sk = d_date_sk
39533956
and d_date between cast('2000-08-10' as date)
3954-
and (cast('2000-08-10' as date) + 30 days)
3957+
and (cast('2000-08-10' as date) + interval '30 days')
39553958
group by cs_call_center_sk
39563959
),
39573960
cr as
@@ -3962,7 +3965,7 @@ with ss as
39623965
date_dim
39633966
where cr_returned_date_sk = d_date_sk
39643967
and d_date between cast('2000-08-10' as date)
3965-
and (cast('2000-08-10' as date) + 30 days)
3968+
and (cast('2000-08-10' as date) + interval '30 days')
39663969
group by cr_call_center_sk
39673970
),
39683971
ws as
@@ -3974,7 +3977,7 @@ with ss as
39743977
web_page
39753978
where ws_sold_date_sk = d_date_sk
39763979
and d_date between cast('2000-08-10' as date)
3977-
and (cast('2000-08-10' as date) + 30 days)
3980+
and (cast('2000-08-10' as date) + interval '30 days')
39783981
and ws_web_page_sk = wp_web_page_sk
39793982
group by wp_web_page_sk),
39803983
wr as
@@ -3986,7 +3989,7 @@ with ss as
39863989
web_page
39873990
where wr_returned_date_sk = d_date_sk
39883991
and d_date between cast('2000-08-10' as date)
3989-
and (cast('2000-08-10' as date) + 30 days)
3992+
and (cast('2000-08-10' as date) + interval '30 days')
39903993
and wr_web_page_sk = wp_web_page_sk
39913994
group by wp_web_page_sk)
39923995
select channel
@@ -4014,7 +4017,7 @@ with ss as
40144017
select 'web channel' as channel
40154018
, ws.wp_web_page_sk as id
40164019
, sales
4017-
, coalesce(returns, 0) returns
4020+
, coalesce(returns, 0) as returns
40184021
, (profit - coalesce(profit_loss,0)) as profit
40194022
from ws left join wr
40204023
on ws.wp_web_page_sk = wr.wp_web_page_sk
@@ -4120,7 +4123,7 @@ with ssr as
41204123
promotion
41214124
where ss_sold_date_sk = d_date_sk
41224125
and d_date between cast('2002-08-14' as date)
4123-
and (cast('2002-08-14' as date) + 30 days)
4126+
and (cast('2002-08-14' as date) + interval '30 days')
41244127
and ss_store_sk = s_store_sk
41254128
and ss_item_sk = i_item_sk
41264129
and i_current_price > 50
@@ -4141,7 +4144,7 @@ with ssr as
41414144
promotion
41424145
where cs_sold_date_sk = d_date_sk
41434146
and d_date between cast('2002-08-14' as date)
4144-
and (cast('2002-08-14' as date) + 30 days)
4147+
and (cast('2002-08-14' as date) + interval '30 days')
41454148
and cs_catalog_page_sk = cp_catalog_page_sk
41464149
and cs_item_sk = i_item_sk
41474150
and i_current_price > 50
@@ -4162,7 +4165,7 @@ group by cp_catalog_page_id)
41624165
promotion
41634166
where ws_sold_date_sk = d_date_sk
41644167
and d_date between cast('2002-08-14' as date)
4165-
and (cast('2002-08-14' as date) + 30 days)
4168+
and (cast('2002-08-14' as date) + interval '30 days')
41664169
and ws_web_site_sk = web_site_sk
41674170
and ws_item_sk = i_item_sk
41684171
and i_current_price > 50
@@ -4241,7 +4244,7 @@ select i_item_id
42414244
where i_current_price between 58 and 58+30
42424245
and inv_item_sk = i_item_sk
42434246
and d_date_sk=inv_date_sk
4244-
and d_date between cast('2001-01-13' as date) and (cast('2001-01-13' as date) + 60 days)
4247+
and d_date between cast('2001-01-13' as date) and (cast('2001-01-13' as date) + interval '60 days')
42454248
and i_manufact_id in (259,559,580,485)
42464249
and inv_quantity_on_hand between 100 and 500
42474250
and ss_item_sk = i_item_sk
@@ -4657,7 +4660,7 @@ where
46574660
i_manufact_id = 714
46584661
and i_item_sk = ws_item_sk
46594662
and d_date between '2000-02-01' and
4660-
(cast('2000-02-01' as date) + 90 days)
4663+
(cast('2000-02-01' as date) + interval '90 days')
46614664
and d_date_sk = ws_sold_date_sk
46624665
and ws_ext_discount_amt
46634666
> (
@@ -4669,7 +4672,7 @@ and ws_ext_discount_amt
46694672
WHERE
46704673
ws_item_sk = i_item_sk
46714674
and d_date between '2000-02-01' and
4672-
(cast('2000-02-01' as date) + 90 days)
4675+
(cast('2000-02-01' as date) + interval '90 days')
46734676
and d_date_sk = ws_sold_date_sk
46744677
)
46754678
order by sum(ws_ext_discount_amt)
@@ -4706,7 +4709,7 @@ from
47064709
,web_site
47074710
where
47084711
d_date between '2002-5-01' and
4709-
(cast('2002-5-01' as date) + 60 days)
4712+
(cast('2002-5-01' as date) + interval '60 days')
47104713
and ws1.ws_ship_date_sk = d_date_sk
47114714
and ws1.ws_ship_addr_sk = ca_address_sk
47124715
and ca_state = 'OK'
@@ -4740,7 +4743,7 @@ from
47404743
,web_site
47414744
where
47424745
d_date between '2001-4-01' and
4743-
(cast('2001-4-01' as date) + 60 days)
4746+
(cast('2001-4-01' as date) + interval '60 days')
47444747
and ws1.ws_ship_date_sk = d_date_sk
47454748
and ws1.ws_ship_addr_sk = ca_address_sk
47464749
and ca_state = 'VA'
@@ -4814,7 +4817,7 @@ where
48144817
and i_category in ('Men', 'Sports', 'Jewelry')
48154818
and ss_sold_date_sk = d_date_sk
48164819
and d_date between cast('1999-02-05' as date)
4817-
and (cast('1999-02-05' as date) + 30 days)
4820+
and (cast('1999-02-05' as date) + interval '60 days')
48184821
group by
48194822
i_item_id
48204823
,i_item_desc

0 commit comments

Comments
 (0)