Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1567981
  • 博文数量: 201
  • 博客积分: 2812
  • 博客等级: 少校
  • 技术积分: 3029
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-18 18:28
个人简介

从事数据库工作多年,目前看好分布式NeSQL/HTAP数据库在企业客户市场的发展。未来的主要方向是——致力于 NewSQL/HTAP 数据库的推广普及。

文章存档

2016年(1)

2015年(8)

2014年(23)

2013年(50)

2012年(32)

2011年(87)

分类: Sybase

2011-02-23 14:17:08

5. 查询执行情况
 
1. Query 1
 
   Oracle执行时间(取三次试行的平均时间):10.54秒 (IQ执行时间:5.96秒)
 
   查询语句:
 
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 lineitem
where l_shipdate <= to_date ('1998-12-01','YYYY-MM-DD') - 90
group by l_returnflag,l_linestatus
order by l_returnflag,l_linestatus;
 
2. Query 3
 
   Oracle执行时间(取三次试行的平均时间):6.55秒 (IQ执行时间:0.76秒)  
 
   查询语句:
 
select * from
(
  select
    l_orderkey,
    sum(l_extendedprice * (1 - l_discount)) as revenue,
    o_orderdate,
    o_shippriority
  from
    customer,
    orders,
    lineitem
  where
    c_mktsegment = 'BUILDING'
    and c_custkey = o_custkey
    and l_orderkey = o_orderkey
    and o_orderdate < to_date( '1995-03-15', 'YYYY-MM-DD')
    and l_shipdate > to_date( '1995-03-15', 'YYYY-MM-DD')
  group by l_orderkey, o_orderdate, o_shippriority
  order by revenue desc, o_orderdate
)
where rownum <= 10;

 
3. Query 9
 
   Oracle执行时间(取三次试行的平均时间):10.02秒 (IQ执行时间:3.04秒)  
   查询语句:
 
select
        nation,
        o_year,
        sum(amount) as sum_profit
from
        (
                select
                        n_name as nation,
                        extract(year from o_orderdate) as o_year,
                        l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
                from
                        part,
                        supplier,
                        lineitem,
                        partsupp,
                        orders,
                        nation
                where
                        s_suppkey = l_suppkey
                        and ps_suppkey = l_suppkey
                        and ps_partkey = l_partkey
                        and p_partkey = l_partkey
                        and o_orderkey = l_orderkey
                        and s_nationkey = n_nationkey
                        and p_name like '%green%'
        ) profit
group by
        nation,
        o_year
order by
        nation,
        o_year desc;
 
4. Query 18
 
   Oracle执行时间(取三次试行的平均时间):7.79秒 (IQ执行时间:1.44秒)  
 
   查询语句:
 
select * from
(
select
        c_name,
        c_custkey,
        o_orderkey,
        o_orderdate,
        o_totalprice,
        sum(l_quantity)
from
        customer,
        orders,
        lineitem
where
        o_orderkey in (
                select
                        l_orderkey
                from
                        lineitem
                group by
                        l_orderkey having
                                sum(l_quantity) > 300
        )
        and c_custkey = o_custkey
        and o_orderkey = l_orderkey
group by
        c_name,
        c_custkey,
        o_orderkey,
        o_orderdate,
        o_totalprice
order by
        o_totalprice desc,
        o_orderdate
)
where rownum<=100;
 
5. Query 21
 
   Oracle执行时间(取三次试行的平均时间):17.04秒 (IQ执行时间:2.33秒)  
 
   查询语句:
 
select * from
(
select
        s_name,
        count(*) as numwait
from
        supplier,
        lineitem l1,
        orders,
        nation
where
        s_suppkey = l1.l_suppkey
        and o_orderkey = l1.l_orderkey
        and o_orderstatus = 'F'
        and l1.l_receiptdate > l1.l_commitdate
        and exists (
                select
                        *
                from
                        lineitem l2
                where
                        l2.l_orderkey = l1.l_orderkey
                        and l2.l_suppkey <> l1.l_suppkey
        )
        and not exists (
                select
                        *
                from
                        lineitem l3
                where
                        l3.l_orderkey = l1.l_orderkey
                        and l3.l_suppkey <> l1.l_suppkey
                        and l3.l_receiptdate > l3.l_commitdate
        )
        and s_nationkey = n_nationkey
        and n_name = 'SAUDI ARABIA'
group by
        s_name
order by
        numwait desc,
        s_name
)
where rownum <=100;
阅读(3141) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~