当前位置: 代码迷 >> 综合 >> 从 TPCH 测试学习性能优化技巧之 Q5
  详细解决方案

从 TPCH 测试学习性能优化技巧之 Q5

热度:17   发布时间:2023-12-09 17:08:19.0

一、     查询要求

 

Q5语句查询得到通过某个地区零件供货商而获得的收入(收入按sum(l_extendedprice * (1 -l_discount))计算)统计信息。可用于决定在给定的区域是否需要建立一个当地分配中心。

Q5语句的特点是:带有分组、排序、聚集操作并存的多表连接查询操作。

 

 

二、     Oracle执行

 

Oracle编写的查询SQL语句如下:

select /*+ parallel(n) */

         n_name,

         sum(l_extendedprice * (1 - l_discount)) as revenue

from

         customer,

         orders,

         lineitem,

         supplier,

         nation,

         region

where

         c_custkey = o_custkey

         and l_orderkey = o_orderkey

         and l_suppkey = s_suppkey

         and c_nationkey = s_nationkey

         and s_nationkey = n_nationkey

         and n_regionkey = r_regionkey

         and r_name = 'ASIA'

         and o_orde