Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

select l _ returnflag, l _ linestatus, sum ( l _ quantity ) as sum _ qty , sum ( l _ extendedprice ) as

select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice*(1-l_discount)) as sum_disc_price,
sum(l_extendedprice*(1-l_discount)*(1+l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
scale1.lineitem
where
l_shipdate <= date '1998-12-01'- interval '90' day
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus;
this is the query plan based on the query above:
Finalize GroupAggregate (cost=231151.60..231153.55 rows=6 width=236)
Group Key: l_returnflag, l_linestatus
-> Gather Merge (cost=231151.60..231153.00 rows=12 width=236)
Workers Planned: 2
-> Sort (cost=230151.58..230151.59 rows=6 width=236)
Sort Key: l_returnflag, l_linestatus
-> Partial HashAggregate (cost=230151.36..230151.50 rows=6 width=236)
Group Key: l_returnflag, l_linestatus
-> Parallel Seq Scan on lineitem (cost=0.00..143854.94 rows=2465612 width=25)
Filter: (l_shipdate <='1998-09-0200:00:00'::timestamp without time zone)
Provide an sketch of a query plan for the column-based approach using late materialization.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

Have ground rules been established for the team?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago