aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraozeritsky <aozeritsky@ydb.tech>2023-09-08 09:14:48 +0300
committeraozeritsky <aozeritsky@ydb.tech>2023-09-08 09:28:54 +0300
commitaa7d4454bfb2b4f21c491fa2829e348b668be8f9 (patch)
tree42e9bb41d352833df76b4f5c4d20610b69e6ee6e
parentb27ebe54a0677e957e81d60d8286b52ad72265af (diff)
downloadydb-aa7d4454bfb2b4f21c491fa2829e348b668be8f9.tar.gz
Optimization: simplify q17
-rw-r--r--ydb/library/benchmarks/queries/tpch/yql/q17.sql24
1 files changed, 8 insertions, 16 deletions
diff --git a/ydb/library/benchmarks/queries/tpch/yql/q17.sql b/ydb/library/benchmarks/queries/tpch/yql/q17.sql
index 33eb2f8b5a..b3367583c9 100644
--- a/ydb/library/benchmarks/queries/tpch/yql/q17.sql
+++ b/ydb/library/benchmarks/queries/tpch/yql/q17.sql
@@ -7,18 +7,7 @@
$threshold = (
select
0.2 * avg(l_quantity) as threshold,
- l_partkey
-from
- {{lineitem}}
-group by
- l_partkey
-);
-
-$join1 = (
-select
- p.p_partkey as p_partkey,
- l.l_extendedprice as l_extendedprice,
- l.l_quantity as l_quantity
+ l.l_partkey as l_partkey
from
{{lineitem}} as l
join
@@ -28,15 +17,18 @@ on
where
p.p_brand = 'Brand#35'
and p.p_container = 'LG DRUM'
+group by
+ l.l_partkey
);
select
- sum(j.l_extendedprice) / 7.0 as avg_yearly
+ sum(l.l_extendedprice) / 7.0 as avg_yearly
from
- $join1 as j
+ {{lineitem}} as l
join
$threshold as t
on
- j.p_partkey = t.l_partkey
+ t.l_partkey = l.l_partkey
where
- j.l_quantity < t.threshold;
+ l.l_quantity < t.threshold;
+