123
返回列表 发新帖
楼主: 〇〇

[笔记] 在pg上作tpch测试步骤

[复制链接]
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
21#
 楼主| 发表于 2011-6-12 20:13 | 只看该作者
pgdb=# -- 20a
pgdb=# select s_name, s_address
pgdb-# from supplier, nation
pgdb-# where s_suppkey in (select ps_suppkey
pgdb(#  from partsupp
pgdb(#  ,(select l_partkey,l_suppkey, sum(l_quantity) l_quantity_SUM
pgdb(#  from lineitem,part
pgdb(#  where l_partkey = p_partkey and p_name like 'bisque%'
pgdb(#  and l_shipdate >= date '1994-01-01'
pgdb(#  and l_shipdate < date '1994-01-01' + interval '1 year'
pgdb(#  GROUP BY l_partkey,l_suppkey
pgdb(#  )a
pgdb(#  where l_partkey = ps_partkey
pgdb(#  and l_suppkey = ps_suppkey
pgdb(#  and ps_availqty > 0.5*l_quantity_SUM
pgdb(#  )
pgdb-#  and s_nationkey = n_nationkey
pgdb-#  and n_name = 'CANADA'
pgdb-# order by s_name
pgdb-# limit 10;
          s_name           |                s_address               
---------------------------+-----------------------------------------
Supplier#000000020        | iybAE,RmTymrZVYaFZva2SH,j
Supplier#000000091        | YV45D7TkfdQanOOZ7q9QxkyGUapU1oOWU6q3
Supplier#000000205        | rF uV8d0JNEk
Supplier#000000285        | Br7e1nnt1yxrw6ImgpJ7YdhFDjuBf
Supplier#000000287        | 7a9SP7qW5Yku5PvSg
Supplier#000000354        | w8fOo5W,aS
Supplier#000000361        | f8IUYRmdVXhQC9qJQjWknCXmzhe38vCbk6
Supplier#000000475        | xw4V6,4QQW LI5Qg EOKy4JD B4Cq1tjzaOma9Y
Supplier#000000530        | 0qwCMwobKY OcmLyfRXlagA8ukENJv,
Supplier#000000532        | ep92hT7VLaVlDKM7lgbj02kIL
(10 rows)

Time: 77448.259 ms

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
22#
 楼主| 发表于 2011-6-12 20:16 | 只看该作者
pgdb=# explain select s_name, s_address
pgdb-# from supplier, nation
pgdb-# where s_suppkey in (select ps_suppkey
pgdb(#  from partsupp
pgdb(#  ,(select l_partkey,l_suppkey, sum(l_quantity) l_quantity_SUM
pgdb(#  from lineitem,part
pgdb(#  where l_partkey = p_partkey and p_name like 'bisque%'
pgdb(#  and l_shipdate >= date '1994-01-01'
pgdb(#  and l_shipdate < date '1994-01-01' + interval '1 year'
pgdb(#  GROUP BY l_partkey,l_suppkey
pgdb(#  )a
pgdb(#  where l_partkey = ps_partkey
pgdb(#  and l_suppkey = ps_suppkey
pgdb(#  and ps_availqty > 0.5*l_quantity_SUM
pgdb(#  )
pgdb-#  and s_nationkey = n_nationkey
pgdb-#  and n_name = 'CANADA'
pgdb-# order by s_name
pgdb-# limit 10;
                                                                              QUERY PLAN                                                                              
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit  (cost=2961118.27..2961118.29 rows=10 width=52)
   ->  Sort  (cost=2961118.27..2961123.27 rows=2000 width=52)
         Sort Key: supplier.s_name
         ->  Nested Loop Semi Join  (cost=2717040.26..2961075.05 rows=2000 width=52)
               Join Filter: (supplier.s_suppkey = lineitem.l_suppkey)
               ->  Hash Join  (cost=1.32..3657.32 rows=4000 width=56)
                     Hash Cond: (supplier.s_nationkey = nation.n_nationkey)
                     ->  Seq Scan on supplier  (cost=0.00..3241.00 rows=100000 width=60)
                     ->  Hash  (cost=1.31..1.31 rows=1 width=4)
                           ->  Seq Scan on nation  (cost=0.00..1.31 rows=1 width=4)
                                 Filter: (n_name = 'CANADA'::bpchar)
               ->  Materialize  (cost=2717038.93..2957057.74 rows=6 width=8)
                     ->  Hash Join  (cost=2717038.93..2957057.71 rows=6 width=8)
                           Hash Cond: ((lineitem.l_partkey = partsupp.ps_partkey) AND (lineitem.l_suppkey = partsupp.ps_suppkey))
                           Join Filter: ((partsupp.ps_availqty)::numeric > (0.5 * (sum(lineitem.l_quantity))))
                           ->  GroupAggregate  (cost=2300669.68..2302871.96 rows=97879 width=15)
                                 ->  Sort  (cost=2300669.68..2300914.38 rows=97879 width=15)
                                       Sort Key: lineitem.l_partkey, lineitem.l_suppkey
                                       ->  Hash Join  (cost=66860.61..2290883.14 rows=97879 width=15)
                                             Hash Cond: (lineitem.l_partkey = part.p_partkey)
                                             ->  Seq Scan on lineitem  (cost=0.00..2084578.86 rows=9230992 width=15)
                                                   Filter: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone))
                                             ->  Hash  (cost=66608.07..66608.07 rows=20203 width=4)
                                                   ->  Seq Scan on part  (cost=0.00..66608.07 rows=20203 width=4)
                                                         Filter: ((p_name)::text ~~ 'bisque%'::text)
                           ->  Hash  (cost=257319.30..257319.30 rows=7999330 width=12)
                                 ->  Seq Scan on partsupp  (cost=0.00..257319.30 rows=7999330 width=12)
(27 rows)

Time: 10.305 ms

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
23#
 楼主| 发表于 2011-6-12 20:17 | 只看该作者
pgdb=# explain select
pgdb-#  s_name,
pgdb-#  s_address
pgdb-# from
pgdb-#  supplier,
pgdb-#  nation
pgdb-# where
pgdb-#  s_suppkey in (
pgdb(#   select
pgdb(#    ps_suppkey
pgdb(#   from
pgdb(#    partsupp
pgdb(#   where
pgdb(#    ps_partkey in (
pgdb(#     select
pgdb(#      p_partkey
pgdb(#     from
pgdb(#      part
pgdb(#     where
pgdb(#      p_name like 'bisque%'
pgdb(#    )
pgdb(#    and ps_availqty > (
pgdb(#     select
pgdb(#      0.5 * sum(l_quantity)
pgdb(#     from
pgdb(#      lineitem
pgdb(#     where
pgdb(#      l_partkey = ps_partkey
pgdb(#      and l_suppkey = ps_suppkey
pgdb(#      and l_shipdate >= date '1994-01-01'
pgdb(#      and l_shipdate < date '1994-01-01' + interval '1 year'
pgdb(#    )
pgdb(#  )
pgdb-#  and s_nationkey = n_nationkey
pgdb-#  and n_name = 'CANADA'
pgdb-# order by
pgdb-#  s_name limit  10;
                                                                                                 QUERY PLAN                                                                                                
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit  (cost=867133998655.19..867133998655.22 rows=10 width=52)
   ->  Sort  (cost=867133998655.19..867133998665.19 rows=4000 width=52)
         Sort Key: supplier.s_name
         ->  Nested Loop Semi Join  (cost=68054.15..867133998568.75 rows=4000 width=52)
               Join Filter: (supplier.s_suppkey = partsupp.ps_suppkey)
               ->  Hash Join  (cost=1.32..3657.32 rows=4000 width=56)
                     Hash Cond: (supplier.s_nationkey = nation.n_nationkey)
                     ->  Seq Scan on supplier  (cost=0.00..3241.00 rows=100000 width=60)
                     ->  Hash  (cost=1.31..1.31 rows=1 width=4)
                           ->  Seq Scan on nation  (cost=0.00..1.31 rows=1 width=4)
                                 Filter: (n_name = 'CANADA'::bpchar)
               ->  Materialize  (cost=68052.82..867125594743.37 rows=123150 width=4)
                     ->  Nested Loop  (cost=68052.82..867125593645.62 rows=123150 width=4)
                           ->  Unique  (cost=68052.82..68153.84 rows=20203 width=4)
                                 ->  Sort  (cost=68052.82..68103.33 rows=20203 width=4)
                                       Sort Key: part.p_partkey
                                       ->  Seq Scan on part  (cost=0.00..66608.07 rows=20203 width=4)
                                             Filter: ((p_name)::text ~~ 'bisque%'::text)
                           ->  Index Scan using partsupp_pkey on partsupp  (cost=0.00..42920631.79 rows=6 width=8)
                                 Index Cond: (partsupp.ps_partkey = part.p_partkey)
                                 Filter: ((partsupp.ps_availqty)::numeric > (SubPlan 1))
                                 SubPlan 1
                                   ->  Aggregate  (cost=2384477.48..2384477.50 rows=1 width=7)
                                         ->  Seq Scan on lineitem  (cost=0.00..2384477.48 rows=1 width=7)
                                               Filter: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_partkey = $0) AND (l_suppkey = $1))
(25 rows)

Time: 62.165 ms
pgdb=#

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
24#
 楼主| 发表于 2011-6-15 06:23 | 只看该作者
pgdb=# explain --  22
pgdb-# select
pgdb-#  cntrycode,
pgdb-#  count(*) as numcust,
pgdb-#  sum(c_acctbal) as totacctbal
pgdb-# from
pgdb-#  (
pgdb(#   select
pgdb(#    substr(c_phone ,1 ,2) as cntrycode,
pgdb(#    c_acctbal
pgdb(#   from
pgdb(#    customer
pgdb(#   where
pgdb(#    substr(c_phone ,1 ,2) in
pgdb(#     ('23', '39', '40', '27', '33', '31', '25')
pgdb(#    and c_acctbal > (
pgdb(#     select
pgdb(#      avg(c_acctbal)
pgdb(#     from
pgdb(#      customer
pgdb(#     where
pgdb(#      c_acctbal > 0.00
pgdb(#      and substr(c_phone ,1 ,2) in
pgdb(#       ('23', '39', '40', '27', '33', '31', '25')
pgdb(#    )
pgdb(#    and not exists (
pgdb(#     select
pgdb(#      *
pgdb(#     from
pgdb(#      orders
pgdb(#     where
pgdb(#      o_custkey = c_custkey
pgdb(#    )
pgdb(#  ) custsale
pgdb-# group by
pgdb-#  cntrycode
pgdb-# order by
pgdb-#  cntrycode limit  10;
                                                            QUERY PLAN                                                            
-----------------------------------------------------------------------------------------------------------------------------------
Limit  (cost=289126.87..289126.90 rows=1 width=24)
   InitPlan 1 (returns $0)
     ->  Aggregate  (cost=75688.04..75688.04 rows=1 width=8)
           ->  Seq Scan on customer  (cost=0.00..75571.00 rows=46813 width=8)
                 Filter: ((c_acctbal > 0.00) AND (substr((c_phone)::text, 1, 2) = ANY ('{23,39,40,27,33,31,25}'::text[])))
   ->  GroupAggregate  (cost=213438.82..213438.86 rows=1 width=24)
         ->  Sort  (cost=213438.82..213438.83 rows=1 width=24)
               Sort Key: (substr((public.customer.c_phone)::text, 1, 2))
               ->  Nested Loop Anti Join  (cost=0.00..213438.81 rows=1 width=24)
                     ->  Seq Scan on customer  (cost=0.00..75571.00 rows=17240 width=28)
                           Filter: ((c_acctbal > $0) AND (substr((c_phone)::text, 1, 2) = ANY ('{23,39,40,27,33,31,25}'::text[])))
                     ->  Index Scan using orders_fk1 on orders  (cost=0.00..70.86 rows=17 width=4)
                           Index Cond: (orders.o_custkey = public.customer.c_custkey)
(13 行)

时间: 20.709 ms
pgdb=# explain -- 17
pgdb-# select
pgdb-#  sum(l_extendedprice) / 7.0 as avg_yearly
pgdb-# from
pgdb-#  lineitem,
pgdb-#  part
pgdb-# where
pgdb-#  p_partkey = l_partkey
pgdb-#  and p_brand = 'Brand#23'
pgdb-#  and p_container = 'MED CAN'
pgdb-#  and l_quantity < (
pgdb(#   select
pgdb(#    0.2 * avg(l_quantity)
pgdb(#   from
pgdb(#    lineitem
pgdb(#   where
pgdb(#    l_partkey = p_partkey
pgdb(#  ) limit  10;
                                                QUERY PLAN                                                
----------------------------------------------------------------------------------------------------------
Limit  (cost=9090485.90..9090485.91 rows=1 width=10)
   ->  Aggregate  (cost=9090485.90..9090485.91 rows=1 width=10)
         ->  Nested Loop  (cost=0.00..9090431.30 rows=21839 width=10)
               Join Filter: (public.lineitem.l_quantity < (SubPlan 1))
               ->  Seq Scan on part  (cost=0.00..71608.29 rows=2081 width=4)
                     Filter: ((p_brand = 'Brand#23'::bpchar) AND (p_container = 'MED CAN'::bpchar))
               ->  Index Scan using lineitem_fk2 on lineitem  (cost=0.00..134.05 rows=31 width=21)
                     Index Cond: (public.lineitem.l_partkey = part.p_partkey)
               SubPlan 1
                 ->  Aggregate  (cost=135.45..135.46 rows=1 width=7)
                       ->  Index Scan using lineitem_fk2 on lineitem  (cost=0.00..135.37 rows=31 width=7)
                             Index Cond: (l_partkey = $0)
(12 行)

时间: 3.414 ms
pgdb=# explain --  17c
pgdb-# select
pgdb-#  sum(l_extendedprice) / 7.0 as avg_yearly
pgdb-# from (select l_extendedprice, l_partkey ,l_quantity
pgdb(#  from
pgdb(#  lineitem,
pgdb(#  part
pgdb(#  where
pgdb(#  p_partkey = l_partkey
pgdb(#  and p_brand = 'Brand#23'
pgdb(#  and p_container = 'MED CAN'
pgdb(#  )b
pgdb-#  ,(select l_partkey,0.2 * avg(l_quantity) p2avg_l_quantity
pgdb(#  from
pgdb(#  (select l_partkey,l_quantity from
pgdb(#  lineitem
pgdb(#  where
pgdb(#  l_partkey in (select p_partkey from part where p_brand = 'Brand#23'and p_container = 'MED CAN')
pgdb(#  )a
pgdb(#  group by l_partkey
pgdb(#  )c
pgdb-# where b.l_partkey=c.l_partkey and b.l_quantity <p2avg_l_quantity
pgdb-# ;
                                                      QUERY PLAN                                                      
----------------------------------------------------------------------------------------------------------------------
Aggregate  (cost=746887.13..746887.14 rows=1 width=10)
   ->  Hash Join  (cost=710378.97..745168.26 rows=687545 width=10)
         Hash Cond: (public.lineitem.l_partkey = public.part.p_partkey)
         Join Filter: (public.lineitem.l_quantity < ((0.2 * avg(public.lineitem.l_quantity))))
         ->  GroupAggregate  (cost=357749.59..359223.70 rows=65516 width=11)
               ->  Sort  (cost=357749.59..357913.38 rows=65516 width=11)
                     Sort Key: public.lineitem.l_partkey
                     ->  Nested Loop  (cost=71613.49..351388.45 rows=65516 width=11)
                           ->  HashAggregate  (cost=71613.49..71634.30 rows=2081 width=4)
                                 ->  Seq Scan on part  (cost=0.00..71608.29 rows=2081 width=4)
                                       Filter: ((p_brand = 'Brand#23'::bpchar) AND (p_container = 'MED CAN'::bpchar))
                           ->  Index Scan using lineitem_fk2 on lineitem  (cost=0.00..134.05 rows=31 width=11)
                                 Index Cond: (public.lineitem.l_partkey = public.part.p_partkey)
         ->  Hash  (cost=351362.44..351362.44 rows=65516 width=25)
               ->  Nested Loop  (cost=0.00..351362.44 rows=65516 width=25)
                     ->  Seq Scan on part  (cost=0.00..71608.29 rows=2081 width=4)
                           Filter: ((p_brand = 'Brand#23'::bpchar) AND (p_container = 'MED CAN'::bpchar))
                     ->  Index Scan using lineitem_fk2 on lineitem  (cost=0.00..134.05 rows=31 width=21)
                           Index Cond: (public.lineitem.l_partkey = public.part.p_partkey)
(19 行)

时间: 2.887 ms
pgdb=# explain --  17d
pgdb-# select
pgdb-#  sum(l_extendedprice) / 7.0 as avg_yearly
pgdb-# from (select l_extendedprice, l_partkey ,l_quantity
pgdb(#  from
pgdb(#  lineitem,
pgdb(#  part
pgdb(#  where
pgdb(#  p_partkey = l_partkey
pgdb(#  and p_brand = 'Brand#23'
pgdb(#  and p_container = 'MED CAN'
pgdb(#  )b
pgdb-#  ,(select l_partkey,0.2 * avg(l_quantity) p2avg_l_quantity
pgdb(#  from
pgdb(#  (select l_partkey,l_quantity from
pgdb(#  lineitem ,(select distinct p_partkey from part where p_brand = 'Brand#23'and p_container = 'MED CAN')t
pgdb(#  where
pgdb(#  l_partkey = p_partkey
pgdb(#  )a
pgdb(#  group by l_partkey
pgdb(#  )c
pgdb-# where b.l_partkey=c.l_partkey and b.l_quantity <p2avg_l_quantity
pgdb-# ;
                                                      QUERY PLAN                                                      
----------------------------------------------------------------------------------------------------------------------
Aggregate  (cost=746835.94..746835.95 rows=1 width=10)
   ->  Hash Join  (cost=710327.78..745117.07 rows=687545 width=10)
         Hash Cond: (public.lineitem.l_partkey = public.part.p_partkey)
         Join Filter: (public.lineitem.l_quantity < ((0.2 * avg(public.lineitem.l_quantity))))
         ->  GroupAggregate  (cost=357698.40..359172.51 rows=65516 width=11)
               ->  Sort  (cost=357698.40..357862.19 rows=65516 width=11)
                     Sort Key: public.lineitem.l_partkey
                     ->  Nested Loop  (cost=71613.49..351337.26 rows=65516 width=11)
                           ->  HashAggregate  (cost=71613.49..71634.30 rows=2081 width=4)
                                 ->  Seq Scan on part  (cost=0.00..71608.29 rows=2081 width=4)
                                       Filter: ((p_brand = 'Brand#23'::bpchar) AND (p_container = 'MED CAN'::bpchar))
                           ->  Index Scan using lineitem_fk2 on lineitem  (cost=0.00..134.01 rows=31 width=11)
                                 Index Cond: (public.lineitem.l_partkey = public.part.p_partkey)
         ->  Hash  (cost=351362.44..351362.44 rows=65516 width=25)
               ->  Nested Loop  (cost=0.00..351362.44 rows=65516 width=25)
                     ->  Seq Scan on part  (cost=0.00..71608.29 rows=2081 width=4)
                           Filter: ((p_brand = 'Brand#23'::bpchar) AND (p_container = 'MED CAN'::bpchar))
                     ->  Index Scan using lineitem_fk2 on lineitem  (cost=0.00..134.05 rows=31 width=21)
                           Index Cond: (public.lineitem.l_partkey = public.part.p_partkey)
(19 行)

时间: 2.261 ms
pgdb=# --  17c
pgdb=# select
pgdb-#  sum(l_extendedprice) / 7.0 as avg_yearly
pgdb-# from (select l_extendedprice, l_partkey ,l_quantity
pgdb(#  from
pgdb(#  lineitem,
pgdb(#  part
pgdb(#  where
pgdb(#  p_partkey = l_partkey
pgdb(#  and p_brand = 'Brand#23'
pgdb(#  and p_container = 'MED CAN'
pgdb(#  )b
pgdb-#  ,(select l_partkey,0.2 * avg(l_quantity) p2avg_l_quantity
pgdb(#  from
pgdb(#  (select l_partkey,l_quantity from
pgdb(#  lineitem
pgdb(#  where
pgdb(#  l_partkey in (select p_partkey from part where p_brand = 'Brand#23'and p_container = 'MED CAN')
pgdb(#  )a
pgdb(#  group by l_partkey
pgdb(#  )c
pgdb-# where b.l_partkey=c.l_partkey and b.l_quantity <p2avg_l_quantity
pgdb-# ;
      avg_yearly      
----------------------
3188455.648571428571
(1 行)

时间: 2836.308 ms
pgdb=# explain -- 18
pgdb-# select
pgdb-#  c_name,
pgdb-#  c_custkey,
pgdb-#  o_orderkey,
pgdb-#  o_orderdate,
pgdb-#  o_totalprice,
pgdb-#  sum(l_quantity)
pgdb-# from
pgdb-#  customer,
pgdb-#  orders,
pgdb-#  lineitem
pgdb-# where
pgdb-#  o_orderkey in (
pgdb(#   select
pgdb(#    l_orderkey
pgdb(#   from
pgdb(#    lineitem
pgdb(#   group by
pgdb(#    l_orderkey having
pgdb(#     sum(l_quantity) > 313
pgdb(#  )
pgdb-#  and c_custkey = o_custkey
pgdb-#  and o_orderkey = l_orderkey
pgdb-# group by
pgdb-#  c_name,
pgdb-#  c_custkey,
pgdb-#  o_orderkey,
pgdb-#  o_orderdate,
pgdb-#  o_totalprice
pgdb-# order by
pgdb-#  o_totalprice desc,
pgdb-#  o_orderdate limit  10;
                                                                   QUERY PLAN                                                                    
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit  (cost=15154938.05..15154938.35 rows=10 width=48)
   ->  GroupAggregate  (cost=15154938.05..16054728.83 rows=29993026 width=48)
         ->  Sort  (cost=15154938.05..15229920.62 rows=29993026 width=48)
               Sort Key: orders.o_totalprice, orders.o_orderdate, customer.c_name, customer.c_custkey, orders.o_orderkey
               ->  Hash Join  (cost=4253312.16..7739531.59 rows=29993026 width=48)
                     Hash Cond: (public.lineitem.l_orderkey = orders.o_orderkey)
                     ->  Seq Scan on lineitem  (cost=0.00..1784743.52 rows=59986052 width=11)
                     ->  Hash  (cost=4093644.16..4093644.16 rows=7500000 width=45)
                           ->  Hash Join  (cost=78736.00..4093644.16 rows=7500000 width=45)
                                 Hash Cond: (orders.o_custkey = customer.c_custkey)
                                 ->  Merge Semi Join  (cost=0.00..3753578.16 rows=7500000 width=26)
                                       Merge Cond: (orders.o_orderkey = public.lineitem.l_orderkey)
                                       ->  Index Scan using orders_pkey on orders  (cost=0.00..657372.90 rows=15000000 width=22)
                                       ->  Materialize  (cost=0.00..3053651.71 rows=404285 width=4)
                                             ->  GroupAggregate  (cost=0.00..3048598.14 rows=404285 width=11)
                                                   Filter: (sum(public.lineitem.l_quantity) > 313::numeric)
                                                   ->  Index Scan using lineitem_fk1 on lineitem  (cost=0.00..2742603.61 rows=59986052 width=11)
                                 ->  Hash  (cost=51196.00..51196.00 rows=1500000 width=23)
                                       ->  Seq Scan on customer  (cost=0.00..51196.00 rows=1500000 width=23)
(19 行)

时间: 50.062 ms
pgdb=# explain --  18c
pgdb-# select
pgdb-#  c_name,
pgdb-#  c_custkey,
pgdb-#  o_orderkey,
pgdb-#  o_orderdate,
pgdb-#  o_totalprice,
pgdb-#  sum(l_quantity)
pgdb-# from
pgdb-#  customer,
pgdb-#  orders,
pgdb-#  lineitem l,
pgdb-# (
pgdb(#   select
pgdb(#    l_orderkey
pgdb(#   from
pgdb(#    lineitem
pgdb(#   group by
pgdb(#    l_orderkey having
pgdb(#     sum(l_quantity) > 313
pgdb(#  )l1
pgdb-# where
pgdb-#  o_orderkey =l1.l_orderkey
pgdb-#  and c_custkey = o_custkey
pgdb-#  and o_orderkey = l.l_orderkey
pgdb-# group by
pgdb-#  c_name,
pgdb-#  c_custkey,
pgdb-#  o_orderkey,
pgdb-#  o_orderdate,
pgdb-#  o_totalprice
pgdb-# order by
pgdb-#  o_totalprice desc,
pgdb-#  o_orderdate limit  10;
                                                                QUERY PLAN                                                                 
-------------------------------------------------------------------------------------------------------------------------------------------
Limit  (cost=6793460.75..6793461.05 rows=10 width=48)
   ->  GroupAggregate  (cost=6793460.75..6841963.67 rows=1616764 width=48)
         ->  Sort  (cost=6793460.75..6797502.66 rows=1616764 width=48)
               Sort Key: orders.o_totalprice, orders.o_orderdate, customer.c_name, customer.c_custkey, orders.o_orderkey
               ->  Hash Join  (cost=3862314.71..6477529.57 rows=1616764 width=48)
                     Hash Cond: (l.l_orderkey = orders.o_orderkey)
                     ->  Seq Scan on lineitem l  (cost=0.00..1784743.52 rows=59986052 width=11)
                     ->  Hash  (cost=3853707.15..3853707.15 rows=404285 width=45)
                           ->  Hash Join  (cost=78736.00..3853707.15 rows=404285 width=45)
                                 Hash Cond: (orders.o_custkey = customer.c_custkey)
                                 ->  Merge Join  (cost=0.00..3752567.45 rows=404285 width=26)
                                       Merge Cond: (lineitem.l_orderkey = orders.o_orderkey)
                                       ->  GroupAggregate  (cost=0.00..3048598.14 rows=404285 width=11)
                                             Filter: (sum(lineitem.l_quantity) > 313::numeric)
                                             ->  Index Scan using lineitem_fk1 on lineitem  (cost=0.00..2742603.61 rows=59986052 width=11)
                                       ->  Index Scan using orders_pkey on orders  (cost=0.00..657372.90 rows=15000000 width=22)
                                 ->  Hash  (cost=51196.00..51196.00 rows=1500000 width=23)
                                       ->  Seq Scan on customer  (cost=0.00..51196.00 rows=1500000 width=23)
(18 行)

时间: 2.452 ms
pgdb=# --  18c
pgdb=# select
pgdb-#  c_name,
pgdb-#  c_custkey,
pgdb-#  o_orderkey,
pgdb-#  o_orderdate,
pgdb-#  o_totalprice,
pgdb-#  sum(l_quantity)
pgdb-# from
pgdb-#  customer,
pgdb-#  orders,
pgdb-#  lineitem l,
pgdb-# (
pgdb(#   select
pgdb(#    l_orderkey
pgdb(#   from
pgdb(#    lineitem
pgdb(#   group by
pgdb(#    l_orderkey having
pgdb(#     sum(l_quantity) > 313
pgdb(#  )l1
pgdb-# where
pgdb-#  o_orderkey =l1.l_orderkey
pgdb-#  and c_custkey = o_custkey
pgdb-#  and o_orderkey = l.l_orderkey
pgdb-# group by
pgdb-#  c_name,
pgdb-#  c_custkey,
pgdb-#  o_orderkey,
pgdb-#  o_orderdate,
pgdb-#  o_totalprice
pgdb-# order by
pgdb-#  o_totalprice desc,
pgdb-#  o_orderdate limit  10;
       c_name       | c_custkey | o_orderkey | o_orderdate | o_totalprice |  sum   
--------------------+-----------+------------+-------------+--------------+--------
Customer#001287812 |   1287812 |   42290181 | 1997-11-26  |    558289.17 | 318.00
Customer#001172513 |   1172513 |   36667107 | 1997-06-06  |    550142.18 | 322.00
Customer#000571654 |    571654 |   21213895 | 1992-01-03  |    549380.08 | 327.00
Customer#000667882 |    667882 |    2199712 | 1996-09-30  |    542154.01 | 327.00
Customer#001471966 |   1471966 |    1263015 | 1997-02-02  |    540476.80 | 320.00
Customer#001101754 |   1101754 |   46794464 | 1992-04-28  |    532623.90 | 320.00
Customer#000591466 |    591466 |   55799200 | 1996-02-11  |    524209.45 | 327.00
Customer#001196317 |   1196317 |   34509573 | 1995-10-15  |    522897.01 | 318.00
Customer#000634048 |    634048 |   36327201 | 1992-04-25  |    519634.30 | 315.00
Customer#001308376 |   1308376 |   28077922 | 1996-10-27  |    518711.99 | 319.00
(10 行)

时间: 93872.013 ms
p

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
25#
 楼主| 发表于 2011-6-15 06:25 | 只看该作者
pgdb=# \timing
开始计时.
pgdb=# create index supplier_fk1 on supplier(s_nationkey);
CREATE INDEX
时间: 241.663 ms
pgdb=# create index customer_fk1 on customer(c_nationkey);
CREATE INDEX
时间: 4671.995 ms
pgdb=# create index partsupp_fk1  on partsupp(ps_suppkey);
CREATE INDEX
时间: 20420.121 ms
pgdb=#
pgdb=# create index partsupp_fk2  on partsupp(ps_partkey);
CREATE INDEX
时间: 14487.640 ms
pgdb=# create index orders_fk1  on orders(o_custkey);
CREATE INDEX
时间: 38558.701 ms
pgdb=# drop index orders_custkey;
DROP INDEX
时间: 98.454 ms
pgdb=# create index lineitem_fk1  on lineitem(l_orderkey);
CREATE INDEX
时间: 103888.944 ms
pgdb=# create index lineitem_fk2  on lineitem(l_partkey,l_suppkey);
CREATE INDEX
时间: 187944.419 ms

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
26#
 楼主| 发表于 2011-6-15 08:45 | 只看该作者
pgdb=# \i /user1/postgresql/data/q1.txt
\i /user1/postgresql/data/q2.txt
\i /user1/postgresql/data/q3.txt
\i /user1/postgresql/data/q4.txt
\i /user1/postgresql/data/q5.txt
\i /user1/postgresql/data/q6.txt
\i /user1/postgresql/data/q7.txt
\i /user1/postgresql/data/q8.txt
\i /user1/postgresql/data/q9.txt
\i /user1/postgresql/data/q10.txt
l_returnflag | l_linestatus |   sum_qty    |  sum_base_price  |   sum_disc_price   |      sum_charge      |       avg_qty       |     avg_price      |        avg_disc        | count_order
--------------+--------------+--------------+------------------+--------------------+----------------------+---------------------+--------------------+------------------------+-------------
A            | F            | 377518399.00 |  566065727797.25 |  537759104278.0656 |  559276670892.116819 | 25.5009751030070973 | 38237.151008958546 | 0.05000657454024320463 |    14804077
N            | F            |   9851614.00 |   14767438399.17 |   14028805792.2114 |   14590490998.366737 | 25.5224483028409474 | 38257.810660081140 | 0.04997336773765667180 |      385998
N            | O            | 731368004.00 | 1096674315157.26 | 1041836574901.1892 | 1083522615974.869816 | 25.4975234176794189 | 38233.117772936887 | 0.04999893982279387268 |    28683884
R            | F            | 377732830.00 |  566431054976.00 |  538110922664.7677 |  559634780885.086257 | 25.5083847896801383 | 38251.219273559761 | 0.04999679231408742045 |    14808183
(4 行)

时间: 376174.735 ms
pgdb=# \i /user1/postgresql/data/q2.txt
s_acctbal |          s_name           |          n_name           | p_partkey |          p_mfgr           |                s_addres
s                 |     s_phone     |                                             s_comment                                         
     
-----------+---------------------------+---------------------------+-----------+---------------------------+------------------------
------------------+-----------------+-----------------------------------------------------------------------------------------------
-----
   9998.20 | Supplier#000006343        | EGYPT                     |   1481328 | Manufacturer#3            | UIRkduD9Iv2sxX9ly6MPt  
                  | 14-617-999-2300 | odolites. unusual packages was carefully reg
   9995.59 | Supplier#000031731        | IRAQ                      |   1356691 | Manufacturer#4            | ihiaqm0S33pkU         
                  | 21-420-388-3738 |  against the special ideas are furiously furiously even platelet
   9995.06 | Supplier#000027193        | JORDAN                    |   1977154 | Manufacturer#2            | kI2QBgD6qOD M2cvm5DHRWg
lie4iiezig6zKBOv, | 23-747-675-5470 | atelets! regular packages doubt furiously. carefully regular requests are thinly fluffily regu
l
   9994.77 | Supplier#000095917        | EGYPT                     |   1620868 | Manufacturer#4            | mAIyuuHBLI hA1SfK z0G6H
4Zh2cq1           | 14-122-667-2946 | s are ironically boldly regular courts. thin, pending ideas along the final packages ha
   9994.53 | Supplier#000021480        | EGYPT                     |    221479 | Manufacturer#4            | peaej4D5vGn8rZLUII6pX3I
fNmA 2VcDalUl     | 14-865-645-9658 | ts. slyly even foxes integrate
   9991.36 | Supplier#000072616        | SAUDI ARABIA              |   1297579 | Manufacturer#3            | b56dOtMSSOOtrnlC HIW,P
                  | 30-646-184-3474 | packages wake. blithely final accounts
   9991.17 | Supplier#000088609        | IRAN                      |    163607 | Manufacturer#1            | JRNiW5tYD4hitywPIBTT6 8
,oDjYxG50FF       | 20-411-629-9083 | ly carefully regular accounts. quickly special packages wake carefully silent dugouts. ironic
   9988.54 | Supplier#000058678        | IRAN                      |    858677 | Manufacturer#2            | a99NyaA2,tkvFZl,B38W6tL
G0MgB1z7QUBT7NEs  | 20-836-702-5861 | fluffily special requests sleep fluffily. platelets
   9987.93 | Supplier#000023626        | IRAQ                      |    948598 | Manufacturer#1            | S2V29u51pq8X1HvBmjMzXnf
h                 | 21-879-146-7865 | e regular requests. doggedly final packages along the bold depths haggle fluffily according to
   9987.88 | Supplier#000042110        | JORDAN                    |    842109 | Manufacturer#3            | cIbkJ267eRaz0EOLYffmhKt
EZBmC0WD7suuj     | 23-236-911-8959 | eep slyly after the furiously regu
   9985.28 | Supplier#000015471        | JORDAN                    |   1265446 | Manufacturer#1            | KkxpZ4X9ZvrUTzWnoKNdJly
T7CHM             | 23-910-981-9900 | sual deposits should are furiously furiously bold foxes--
   9980.06 | Supplier#000082893        | JORDAN                    |    607874 | Manufacturer#4            | mq2vZk4kN8CGPOkaRBfQ2  
                  | 23-649-879-6678 | its detect even ideas. special, bold
   9980.06 | Supplier#000082893        | JORDAN                    |   1757875 | Manufacturer#3            | mq2vZk4kN8CGPOkaRBfQ2  
                  | 23-649-879-6678 | its detect even ideas. special, bold
   9977.50 | Supplier#000071422        | JORDAN                    |    121419 | Manufacturer#3            | 9gcfSdmwqRhsB F656GMhdz
9HE2              | 23-986-349-5329 | latelets. slyly express instructions are
   9977.47 | Supplier#000098649        | JORDAN                    |    798648 | Manufacturer#2            | wt1at1SD5O8d7IdI86,1Uuj
wgakT            | 23-632-753-6116 | equests. even excuses according to the q
   9972.04 | Supplier#000012927        | IRAN                      |   1762892 | Manufacturer#1            | DRK,7vfLKQ YKAflicm217t
Ph Qp8BTb0UDrHGvh | 20-377-510-1047 | usual excuses across the even accounts are slyly
   9964.85 | Supplier#000099218        | SAUDI ARABIA              |   1774200 | Manufacturer#3            | N8DkYGUnTOmNEcpPvyM99uc
qLdFX0KNlHUxrX8GQ | 30-784-263-6071 | ironic packages-- special ideas haggle across the regular packages. packages
   9958.64 | Supplier#000061965        | EGYPT                     |    761964 | Manufacturer#1            | Edt9WKXBmLgSke1F6Q8pTKA
MtChXK9uENY       | 14-977-296-3935 | es maintain. slyly ironic accounts wak
   9958.10 | Supplier#000076950        | IRAN                      |    601931 | Manufacturer#4            | P98dqRA5oIIxk g7ftaNU  
                  | 20-356-185-4644 | iously final theodolites. warhorses print. furiously unusual accounts
   9954.88 | Supplier#000062508        | IRAQ                      |    812491 | Manufacturer#2            | x8DvMnPj DEgognqGTi   
                  | 21-937-593-7894 | the unusual requests. quickly final requests wake carefully
   9954.35 | Supplier#000003248        | SAUDI ARABIA              |    478243 | Manufacturer#4            | MgrlLKjfFaVF3qqeoSUL AT
YGRCf             | 30-474-806-7433 | ironic packages. quickly regular pearls are quickly slyly ironic theodolites. foxes a
   9951.47 | Supplier#000068549        | IRAN                      |   1393509 | Manufacturer#2            | Brdeg9R7E3FUob xbcTFNrz
6aU               | 20-439-591-9858 | out the instructions haggle car
   9951.03 | Supplier#000062799        | SAUDI ARABIA              |     62798 | Manufacturer#4            | ,IN29m76lXAnLT7s2ZA99kJ
6ilEEHzKf         | 30-156-744-3950 | riously carefully express
   9944.40 | Supplier#000073152        | IRAQ                      |     73151 | Manufacturer#4            | f YJVmkRE2zvmSWSn      
                  | 21-162-697-5635 | c foxes. thinly final dependencie
   9943.42 | Supplier#000074558        | SAUDI ARABIA              |   1699509 | Manufacturer#4            | oZX50xdufrI9J6X9YO19qiU
NVTreybcwRX8o     | 30-400-557-8664 | hins. quickly unusual deposits run; bli
   9942.15 | Supplier#000059269        | IRAN                      |    534263 | Manufacturer#5            | 4dq8uYfrpNh0V2OOlre0XYP
Icn               | 20-326-153-4109 | ent deposits haggle. furiously stealthy requests must are furiously against the s
   9940.63 | Supplier#000016417        | EGYPT                     |    141413 | Manufacturer#3            | CYOn22bPeW9IVBK Mx     
                  | 14-454-677-3135 | uickly pending packages. stealthy account
   9939.66 | Supplier#000019287        | JORDAN                    |    869270 | Manufacturer#1            | UEYgnb 2KCDfBaNHMe1YIjq
femDF5Mx76Z67RtT  | 23-393-379-2958 | lar, bold excuses. slyly silent deposit
   9934.50 | Supplier#000031048        | JORDAN                    |    481039 | Manufacturer#2            | FKPtZtWe6a6etVF6rtftnYP
S6xFpPJ pE,2N,    | 23-113-690-2419 |  ironic instructions according to the blithely express platelets
   9933.71 | Supplier#000047743        | EGYPT                     |     72742 | Manufacturer#4            | tLuh7jr4 ,            
                  | 14-617-231-4703 | d deposits on the regular packages breach slyly furiously final accounts. careful
   9932.22 | Supplier#000055514        | SAUDI ARABIA              |   1355513 | Manufacturer#2            | FsnY5xy oRp            
                  | 30-697-247-8038 | ss ideas according to the silently even theodolites are about the final theodolites. ironic,
   9931.71 | Supplier#000096309        | EGYPT                     |   1121275 | Manufacturer#4            | 7b03z syyE            
                  | 14-208-104-6810 |  at the regular accounts are blithely p
   9931.36 | Supplier#000098819        | IRAN                      |    598818 | Manufacturer#3            | AtwS02uQIL XuPknU      
                  | 20-235-423-6337 | egular accounts detect carefully regular packages. slyly ironic
   9924.67 | Supplier#000062082        | IRAQ                      |    262081 | Manufacturer#2            | q3K8b6MzXyLvJkdi      
                  | 21-316-109-3592 | ously blithely unusual ideas? carefully ironic
   9916.06 | Supplier#000059761        | EGYPT                     |    709746 | Manufacturer#1            | qhMjY2VfLi63dxXeiAEO   
                  | 14-724-147-4221 | p according to the carefully unusual instructions. regular, even pinto beans according to the
regu
   9916.06 | Supplier#000059761        | EGYPT                     |   1259760 | Manufacturer#3            | qhMjY2VfLi63dxXeiAEO   
                  | 14-724-147-4221 | p according to the carefully unusual instructions. regular, even pinto beans according to the
regu
   9914.75 | Supplier#000098748        | IRAQ                      |    198747 | Manufacturer#4            | qql,VAn9gecc           
                  | 21-899-593-7949 | s wake quickly. ironic deposits above the foxes cajole carefully final pinto beans. ironic, fi
nal
   9914.65 | Supplier#000098348        | IRAQ                      |    298347 | Manufacturer#5            | YmVRpWuwnzetnjN8DSPWk  
                  | 21-357-591-3985 | yly express ideas are evenly. ironic accounts haggl
   9913.61 | Supplier#000042219        | JORDAN                    |   1467176 | Manufacturer#3            | i6AT9EJgmExy73l0LSLATmr
056ji             | 23-338-799-1347 | even packages. blithely regular pinto beans
   9903.69 | Supplier#000019183        | IRAQ                      |    294180 | Manufacturer#4            | c72mOn6I4vbWtvcKoqGrQg
                  | 21-868-358-2337 | unusual, express requests are. even foxes sleep fluffily per
   9899.72 | Supplier#000061913        | JORDAN                    |    936903 | Manufacturer#4            | L4  9BEpYwbSRqsJwhYgeHz
1bSzK36m6JZ08     | 23-880-361-4405 | xes. slyly regular deposits integrate fluffily. quickly final accoun
   9899.72 | Supplier#000061913        | JORDAN                    |   1061912 | Manufacturer#5            | L4  9BEpYwbSRqsJwhYgeHz
1bSzK36m6JZ08     | 23-880-361-4405 | xes. slyly regular deposits integrate fluffily. quickly final accoun
   9897.83 | Supplier#000048061        | JORDAN                    |   1873006 | Manufacturer#1            | PI9CqHyqDv7b8iJDOqw   
                  | 23-335-971-1414 | kages use sometimes alongside of the slyly ironic deposits. deposits haggl
/user1/postgresql/data/q3.txt
Pattern not found
时间: 13208.299 ms
pgdb=# \i /user1/postgresql/data/q4.txt
o_orderpriority | order_count
-----------------+-------------
1-URGENT        |      105830
2-HIGH          |      105465
3-MEDIUM        |      104928
4-NOT SPECIFIED |      104715
5-LOW           |      104977
(5 行)

时间: 11679.538 ms
pgdb=# \i /user1/postgresql/data/q5.txt
          n_name           |    revenue     
---------------------------+----------------
CANADA                    | 545812773.7002
UNITED STATES             | 537504828.4756
ARGENTINA                 | 530792211.9317
PERU                      | 523818935.3510
BRAZIL                    | 522301577.4584
(5 行)

时间: 60537.669 ms
pgdb=# \i /user1/postgresql/data/q6.txt
    revenue     
----------------
615647213.2901
(1 行)

时间: 25199.288 ms
pgdb=# \i /user1/postgresql/data/q7.txt
        supp_nation        |        cust_nation        | l_year |    revenue     
---------------------------+---------------------------+--------+----------------
ARGENTINA                 | FRANCE                    |   1995 | 531156727.2505
ARGENTINA                 | FRANCE                    |   1996 | 538746468.5274
FRANCE                    | ARGENTINA                 |   1995 | 523667981.8327
FRANCE                    | ARGENTINA                 |   1996 | 529761492.9053
(4 行)

时间: 46555.689 ms
pgdb=# \i /user1/postgresql/data/q8.txt
o_year |       mkt_share        
--------+------------------------
   1995 | 0.03955424769916200685
   1996 | 0.03846446765981474593
(2 行)

时间: 13250.789 ms
pgdb=# \i /user1/postgresql/data/q9.txt
          nation           | o_year |   sum_profit   
---------------------------+--------+----------------
ALGERIA                   |   1998 | 234330090.6783
ALGERIA                   |   1997 | 391966649.0005
ALGERIA                   |   1996 | 404034204.1157
ALGERIA                   |   1995 | 403462843.9338
ALGERIA                   |   1994 | 402784606.2745
ALGERIA                   |   1993 | 398841478.8185
ALGERIA                   |   1992 | 404765625.1432
ARGENTINA                 |   1998 | 243450288.9569
ARGENTINA                 |   1997 | 410171772.5992
ARGENTINA                 |   1996 | 410221608.5212
ARGENTINA                 |   1995 | 415753441.0531
ARGENTINA                 |   1994 | 399047906.2887
ARGENTINA                 |   1993 | 409755227.1630
ARGENTINA                 |   1992 | 413865155.9172
BRAZIL                    |   1998 | 240693428.8533
BRAZIL                    |   1997 | 417693474.2203
BRAZIL                    |   1996 | 405953590.3475
BRAZIL                    |   1995 | 409880946.8241
BRAZIL                    |   1994 | 407300645.7661
BRAZIL                    |   1993 | 408042415.3338
BRAZIL                    |   1992 | 414047954.3398
CANADA                    |   1998 | 244983025.8749
CANADA                    |   1997 | 418336335.2738
CANADA                    |   1996 | 423798183.9199
CANADA                    |   1995 | 416543940.0847
CANADA                    |   1994 | 427795392.6617
CANADA                    |   1993 | 420200723.9569
CANADA                    |   1992 | 418205857.8423
CHINA                     |   1998 | 241858023.3272
CHINA                     |   1997 | 410350393.3003
CHINA                     |   1996 | 414264238.5718
CHINA                     |   1995 | 409007988.5742
CHINA                     |   1994 | 408039531.1228
CHINA                     |   1993 | 409367328.5252
CHINA                     |   1992 | 416261881.7005
EGYPT                     |   1998 | 236224654.2289
EGYPT                     |   1997 | 398939249.5398
EGYPT                     |   1996 | 405458181.1200
EGYPT                     |   1995 | 401268318.6133
EGYPT                     |   1994 | 402927818.6114
EGYPT                     |   1993 | 401197036.5802
EGYPT                     |   1992 | 402423627.7128
ETHIOPIA                  |   1998 | 232802321.8100
ETHIOPIA                  |   1997 | 402697339.0839
ETHIOPIA                  |   1996 | 400980908.4769
ETHIOPIA                  |   1995 | 405467848.3950
ETHIOPIA                  |   1994 | 399225845.2266
ETHIOPIA                  |   1993 | 402641118.0456
ETHIOPIA                  |   1992 | 399260402.0256
FRANCE                    |   1998 | 239405952.9605
FRANCE                    |   1997 | 400341204.6217
FRANCE                    |   1996 | 406278779.5671
FRANCE                    |   1995 | 404004337.6845
FRANCE                    |   1994 | 403505812.4304
FRANCE                    |   1993 | 399055024.1588
FRANCE                    |   1992 | 401406521.9874
GERMANY                   |   1998 | 246461631.8497
GERMANY                   |   1997 | 412982797.6880
GERMANY                   |   1996 | 412491806.2380
GERMANY                   |   1995 | 410047978.0097
GERMANY                   |   1994 | 405790352.8234
GERMANY                   |   1993 | 408514144.3109
GERMANY                   |   1992 | 415167928.3067
INDIA                     |   1998 | 238772302.1401
INDIA                     |   1997 | 410710415.2944
INDIA                     |   1996 | 424376089.2569
INDIA                     |   1995 | 416255824.7072
INDIA                     |   1994 | 418711930.6463
INDIA                     |   1993 | 414846388.6557
INDIA                     |   1992 | 422402816.3472
INDONESIA                 |   1998 | 240999977.9952
INDONESIA                 |   1997 | 409153574.2025
INDONESIA                 |   1996 | 413872289.9886
INDONESIA                 |   1995 | 411424971.9302
INDONESIA                 |   1994 | 414478421.9353
INDONESIA                 |   1993 | 412486248.1566
INDONESIA                 |   1992 | 414272078.7159
IRAN                      |   1998 | 240487453.9782
IRAN                      |   1997 | 411804514.1172
IRAN                      |   1996 | 409028561.3612
IRAN                      |   1995 | 410937616.1595
IRAN                      |   1994 | 406374197.4770
IRAN                      |   1993 | 404490778.3571
IRAN                      |   1992 | 404008839.7746
IRAQ                      |   1998 | 247867602.3535
IRAQ                      |   1997 | 418760903.1572
IRAQ                      |   1996 | 419402694.8731
IRAQ                      |   1995 | 417227176.4143
IRAQ                      |   1994 | 422691494.7885
IRAQ                      |   1993 | 419692791.6662
IRAQ                      |   1992 | 413784847.1387
JAPAN                     |   1998 | 237029064.7940
JAPAN                     |   1997 | 407871297.6953
JAPAN                     |   1996 | 405648173.1120
/user1/postgresql/data/q10.txt
Pattern not found
时间: 195510.340 ms
pgdb=# \i /user1/postgresql/data/q11.txt
\i /user1/postgresql/data/q12.txt
\i /user1/postgresql/data/q13.txt
\i /user1/postgresql/data/q14.txt
\i /user1/postgresql/data/q15.txt
\i /user1/postgresql/data/q16.txt
\i /user1/postgresql/data/q17.txt
\i /user1/postgresql/data/q18.txt
\i /user1/postgresql/data/q19.txt
\i /user1/postgresql/data/q20.txt
\i /user1/postgresql/data/q21.txt
\i /user1/postgresql/data/q22.txt
ps_partkey | value
------------+-------
(0 行)

时间: 7310.547 ms
pgdb=# \i /user1/postgresql/data/q12.txt
l_shipmode | high_line_count | low_line_count
------------+-----------------+----------------
FOB        |           62623 |          93407
TRUCK      |           62305 |          93899
(2 行)

时间: 38748.392 ms
pgdb=# \i /user1/postgresql/data/q13.txt
c_count | custdist
---------+----------
       0 |   500018
      10 |    66108
       9 |    65100
      11 |    62178
       8 |    58499
      12 |    55678
      13 |    49998
       7 |    46640
      19 |    46511
      18 |    46223
      20 |    45316
      14 |    45281
      17 |    45214
      16 |    44055
      15 |    43594
      21 |    42269
      22 |    38055
       6 |    32943
      23 |    32647
      24 |    26643
      25 |    21031
       5 |    19689
      26 |    16047
      27 |    11606
       4 |     9934
      28 |     8233
      29 |     5595
       3 |     4013
      30 |     3660
      31 |     2349
      32 |     1494
       2 |     1206
      33 |      857
      34 |      486
      35 |      267
       1 |      244
      36 |      159
      37 |       72
      38 |       45
      39 |       17
      40 |       12
      41 |        7
      42 |        3
      43 |        2
      46 |        1
      44 |        1
(46 行)

时间: 48924.073 ms
pgdb=# \i /user1/postgresql/data/q14.txt
    promo_revenue   
---------------------
16.6465919709262871
(1 行)

时间: 25269.391 ms
pgdb=# \i /user1/postgresql/data/q15.txt
CREATE VIEW
时间: 117.407 ms
s_suppkey |          s_name           |      s_address       |     s_phone     | total_revenue
-----------+---------------------------+----------------------+-----------------+---------------
     33987 | Supplier#000033987        | oHFS5orEHtYMgOS3RGWR | 13-117-218-7219 |  2296670.4443
(1 行)

时间: 52010.887 ms
DROP VIEW
时间: 9.236 ms
pgdb=# \i /user1/postgresql/data/q16.txt
  p_brand   |          p_type           | p_size | supplier_cnt
------------+---------------------------+--------+--------------
Brand#12   | STANDARD POLISHED COPPER  |     14 |          100
Brand#33   | LARGE BURNISHED NICKEL    |     35 |          100
Brand#54   | PROMO ANODIZED BRASS      |     35 |          100
Brand#14   | LARGE PLATED BRASS        |     24 |           96
Brand#23   | PROMO BURNISHED STEEL     |     14 |           96
Brand#41   | SMALL POLISHED STEEL      |     33 |           96
Brand#52   | PROMO POLISHED STEEL      |     35 |           96
Brand#53   | ECONOMY POLISHED NICKEL   |      2 |           96
Brand#32   | LARGE POLISHED COPPER     |     14 |           95
Brand#32   | SMALL POLISHED NICKEL     |      2 |           95
Brand#11   | SMALL BURNISHED STEEL     |     35 |           92
Brand#13   | ECONOMY PLATED STEEL      |     33 |           92
Brand#13   | PROMO BRUSHED STEEL       |      7 |           92
Brand#22   | LARGE PLATED TIN          |     24 |           92
Brand#31   | STANDARD ANODIZED STEEL   |     24 |           92
Brand#32   | MEDIUM POLISHED COPPER    |     20 |           92
Brand#41   | SMALL ANODIZED TIN        |     20 |           92
Brand#45   | MEDIUM POLISHED COPPER    |     33 |           92
Brand#52   | STANDARD BURNISHED COPPER |     24 |           92
Brand#13   | MEDIUM ANODIZED NICKEL    |     21 |           91
Brand#22   | SMALL BURNISHED BRASS     |     33 |           91
Brand#11   | STANDARD BURNISHED COPPER |     14 |           88
Brand#12   | ECONOMY PLATED BRASS      |     35 |           88
Brand#12   | STANDARD BRUSHED COPPER   |     33 |           88
Brand#13   | STANDARD PLATED COPPER    |     33 |           88
Brand#14   | MEDIUM BRUSHED COPPER     |      7 |           88
Brand#14   | MEDIUM POLISHED NICKEL    |      2 |           88
Brand#15   | ECONOMY ANODIZED NICKEL   |     24 |           88
Brand#21   | SMALL BRUSHED NICKEL      |     21 |           88
Brand#21   | SMALL PLATED COPPER       |      7 |           88
Brand#22   | LARGE ANODIZED BRASS      |     24 |           88
Brand#23   | STANDARD BURNISHED NICKEL |     21 |           88
Brand#25   | PROMO BRUSHED STEEL       |     24 |           88
Brand#31   | SMALL BRUSHED COPPER      |      2 |           88
Brand#31   | STANDARD POLISHED NICKEL  |      2 |           88
Brand#33   | MEDIUM BURNISHED COPPER   |      7 |           88
Brand#33   | PROMO BRUSHED STEEL       |     21 |           88
Brand#41   | SMALL BURNISHED COPPER    |     33 |           88
Brand#42   | MEDIUM POLISHED COPPER    |     35 |           88
Brand#43   | MEDIUM BRUSHED BRASS      |     35 |           88
Brand#43   | MEDIUM BURNISHED COPPER   |     14 |           88
Brand#51   | SMALL BURNISHED TIN       |      7 |           88
Brand#52   | MEDIUM ANODIZED BRASS     |     20 |           88
Brand#53   | SMALL POLISHED BRASS      |     20 |           88
Brand#11   | PROMO ANODIZED NICKEL     |     33 |           84
Brand#11   | PROMO ANODIZED TIN        |     14 |           84
Brand#12   | ECONOMY BRUSHED BRASS     |     14 |           84
Brand#12   | PROMO ANODIZED NICKEL     |     33 |           84
Brand#12   | SMALL ANODIZED TIN        |      2 |           84
Brand#12   | STANDARD ANODIZED STEEL   |     14 |           84
Brand#13   | ECONOMY ANODIZED COPPER   |     24 |           84
Brand#13   | ECONOMY ANODIZED STEEL    |     33 |           84
Brand#13   | SMALL POLISHED BRASS      |     21 |           84
Brand#14   | PROMO BURNISHED BRASS     |     14 |           84
Brand#14   | PROMO PLATED COPPER       |     14 |           84
Brand#14   | PROMO PLATED STEEL        |     33 |           84
Brand#14   | SMALL BURNISHED BRASS     |      2 |           84
Brand#15   | ECONOMY BRUSHED NICKEL    |      2 |           84
Brand#15   | MEDIUM POLISHED TIN       |      2 |           84
Brand#15   | PROMO POLISHED STEEL      |     20 |           84
Brand#21   | SMALL PLATED STEEL        |     20 |           84
Brand#22   | LARGE ANODIZED TIN        |      7 |           84
Brand#22   | LARGE PLATED STEEL        |     33 |           84
Brand#23   | ECONOMY BRUSHED COPPER    |     35 |           84
Brand#23   | MEDIUM BURNISHED STEEL    |     14 |           84
Brand#24   | LARGE BRUSHED STEEL       |     33 |           84
Brand#24   | MEDIUM PLATED COPPER      |      2 |           84
Brand#24   | PROMO ANODIZED BRASS      |     21 |           84
Brand#24   | PROMO ANODIZED NICKEL     |     21 |           84
Brand#25   | ECONOMY PLATED TIN        |     20 |           84
Brand#25   | SMALL ANODIZED COPPER     |      2 |           84
Brand#31   | PROMO ANODIZED NICKEL     |     14 |           84
Brand#31   | PROMO PLATED COPPER       |     35 |           84
Brand#32   | MEDIUM BURNISHED NICKEL   |     24 |           84
Brand#32   | MEDIUM POLISHED BRASS     |      7 |           84
Brand#32   | MEDIUM POLISHED STEEL     |      2 |           84
Brand#33   | ECONOMY ANODIZED BRASS    |      2 |           84
Brand#33   | LARGE PLATED STEEL        |     14 |           84
Brand#33   | STANDARD BRUSHED NICKEL   |     14 |           84
Brand#33   | STANDARD POLISHED STEEL   |     24 |           84
Brand#34   | MEDIUM POLISHED COPPER    |      7 |           84
Brand#34   | PROMO ANODIZED BRASS      |      2 |           84
Brand#41   | PROMO BURNISHED TIN       |     14 |           84
Brand#42   | STANDARD ANODIZED BRASS   |     33 |           84
Brand#43   | LARGE BURNISHED BRASS     |     14 |           84
Brand#44   | MEDIUM POLISHED COPPER    |     20 |           84
Brand#44   | SMALL PLATED COPPER       |      2 |           84
Brand#44   | STANDARD POLISHED TIN     |     21 |           84
Brand#51   | STANDARD BURNISHED TIN    |      2 |           84
Brand#52   | SMALL POLISHED BRASS      |     35 |           84
Brand#52   | STANDARD BRUSHED NICKEL   |     21 |           84
Brand#55   | LARGE BURNISHED STEEL     |     21 |           84
Brand#55   | MEDIUM ANODIZED STEEL     |     14 |           84
Brand#55   | SMALL BURNISHED TIN       |     20 |           84
/user1/postgresql/data/q17.txt
Pattern not found
时间: 17618.846 ms
pgdb=# \i /user1/postgresql/data/q18.txt
       c_name       | c_custkey | o_orderkey | o_orderdate | o_totalprice |  sum   
--------------------+-----------+------------+-------------+--------------+--------
Customer#001287812 |   1287812 |   42290181 | 1997-11-26  |    558289.17 | 318.00
Customer#001172513 |   1172513 |   36667107 | 1997-06-06  |    550142.18 | 322.00
Customer#000571654 |    571654 |   21213895 | 1992-01-03  |    549380.08 | 327.00
Customer#000667882 |    667882 |    2199712 | 1996-09-30  |    542154.01 | 327.00
Customer#001471966 |   1471966 |    1263015 | 1997-02-02  |    540476.80 | 320.00
Customer#001101754 |   1101754 |   46794464 | 1992-04-28  |    532623.90 | 320.00
Customer#000591466 |    591466 |   55799200 | 1996-02-11  |    524209.45 | 327.00
Customer#001196317 |   1196317 |   34509573 | 1995-10-15  |    522897.01 | 318.00
Customer#000634048 |    634048 |   36327201 | 1992-04-25  |    519634.30 | 315.00
Customer#001308376 |   1308376 |   28077922 | 1996-10-27  |    518711.99 | 319.00
Customer#000008782 |      8782 |   29294434 | 1993-01-05  |    518140.85 | 322.00
Customer#001232356 |   1232356 |   52340710 | 1993-01-01  |    512292.83 | 320.00
Customer#000287270 |    287270 |   37531878 | 1997-03-20  |    512044.58 | 315.00
Customer#001247930 |   1247930 |   59138305 | 1993-10-31  |    509372.97 | 321.00
Customer#000357649 |    357649 |   51184261 | 1998-07-05  |    508562.74 | 315.00
Customer#000998485 |    998485 |   51532000 | 1992-10-27  |    506996.90 | 319.00
Customer#001179178 |   1179178 |    2869152 | 1996-06-20  |    505142.88 | 317.00
Customer#000942725 |    942725 |   48881602 | 1993-09-19  |    504197.89 | 327.00
Customer#000212452 |    212452 |   23245603 | 1994-11-22  |    504070.63 | 321.00
Customer#000266747 |    266747 |   41274690 | 1992-08-10  |    503260.49 | 317.00
Customer#000896006 |    896006 |   24923202 | 1993-10-04  |    503198.09 | 316.00
Customer#000166589 |    166589 |   46685344 | 1993-12-14  |    496075.11 | 327.00
Customer#000324296 |    324296 |   26465922 | 1996-11-04  |    493279.72 | 331.00
Customer#001081807 |   1081807 |    8075589 | 1996-08-23  |    492479.61 | 316.00
Customer#000303352 |    303352 |   25243237 | 1996-06-30  |    488918.55 | 315.00
Customer#000389473 |    389473 |   21135524 | 1992-11-22  |    487245.56 | 320.00
Customer#001151815 |   1151815 |   55722822 | 1995-08-24  |    485654.49 | 316.00
Customer#000372146 |    372146 |   48300454 | 1992-11-30  |    484962.56 | 318.00
Customer#000225562 |    225562 |   39492870 | 1995-08-12  |    484782.87 | 317.00
Customer#000109402 |    109402 |   10612710 | 1995-02-05  |    484659.70 | 319.00
Customer#000604861 |    604861 |   45897379 | 1994-05-30  |    481442.14 | 318.00
Customer#000347839 |    347839 |   53623108 | 1995-05-07  |    481251.56 | 316.00
Customer#001350514 |   1350514 |   43245189 | 1994-11-29  |    480988.72 | 320.00
Customer#000456290 |    456290 |   58000519 | 1996-01-17  |    480280.84 | 325.00
Customer#001076014 |   1076014 |   58919845 | 1995-07-21  |    478889.03 | 316.00
Customer#001379158 |   1379158 |   49474597 | 1992-03-06  |    478863.46 | 319.00
Customer#001115629 |   1115629 |   13165024 | 1992-06-29  |    477665.31 | 318.00
Customer#000598354 |    598354 |   56497062 | 1998-04-28  |    476882.56 | 320.00
Customer#001424164 |   1424164 |   48395044 | 1994-06-03  |    476439.88 | 316.00
Customer#000008846 |      8846 |   39702437 | 1995-11-23  |    475436.36 | 321.00
Customer#001075219 |   1075219 |   44143908 | 1992-02-24  |    472296.80 | 325.00
Customer#000156190 |    156190 |    3767271 | 1996-08-07  |    471132.45 | 318.00
Customer#000087946 |     87946 |   10805828 | 1997-07-29  |    469150.80 | 316.00
Customer#001073371 |   1073371 |   40356833 | 1998-04-29  |    467532.60 | 315.00
Customer#001209827 |   1209827 |   12314084 | 1994-05-16  |    467104.78 | 325.00
Customer#001146131 |   1146131 |   20662370 | 1992-07-22  |    466829.08 | 315.00
Customer#001268641 |   1268641 |    4702759 | 1994-11-07  |    466780.36 | 320.00
Customer#000366184 |    366184 |    4806726 | 1995-01-17  |    466287.90 | 328.00
Customer#000317285 |    317285 |   44178691 | 1998-01-24  |    459635.14 | 316.00
Customer#000773062 |    773062 |   38914978 | 1996-05-28  |    458849.50 | 324.00
Customer#001380298 |   1380298 |   13837220 | 1994-09-07  |    454998.75 | 316.00
Customer#000952849 |    952849 |   40944001 | 1993-12-15  |    454781.75 | 319.00
Customer#000109817 |    109817 |   10408580 | 1994-09-03  |    454420.76 | 320.00
Customer#000064357 |     64357 |    7235014 | 1998-03-09  |    454343.05 | 323.00
Customer#001140475 |   1140475 |   29122912 | 1996-05-08  |    453750.44 | 323.00
Customer#000523666 |    523666 |   32393895 | 1993-08-09  |    453417.44 | 316.00
Customer#001281199 |   1281199 |    4722021 | 1994-04-07  |    452129.83 | 323.00
Customer#000353261 |    353261 |   22017989 | 1996-06-17  |    452128.50 | 318.00
Customer#000631198 |    631198 |   12378086 | 1995-03-13  |    447447.22 | 320.00
Customer#000665395 |    665395 |    7810823 | 1998-01-05  |    447000.47 | 324.00
Customer#001187939 |   1187939 |   34937604 | 1995-01-26  |    446503.03 | 315.00
Customer#000181624 |    181624 |   17457767 | 1993-06-05  |    445836.21 | 316.00
Customer#001481954 |   1481954 |   43609317 | 1996-02-17  |    444565.67 | 325.00
Customer#001163407 |   1163407 |   11141606 | 1997-09-28  |    442694.39 | 325.00
Customer#000981457 |    981457 |   20971013 | 1997-08-12  |    442063.33 | 322.00
Customer#000500566 |    500566 |   35383045 | 1997-12-11  |    441239.00 | 317.00
Customer#000853729 |    853729 |   15071267 | 1994-10-22  |    440971.36 | 317.00
Customer#001446161 |   1446161 |    3043270 | 1997-02-12  |    440814.69 | 317.00
Customer#001242919 |   1242919 |   49847329 | 1995-09-20  |    440255.61 | 319.00
Customer#000167087 |    167087 |   17366275 | 1998-01-14  |    437804.26 | 316.00
Customer#001180559 |   1180559 |   19217698 | 1993-03-26  |    437603.57 | 316.00
Customer#000644810 |    644810 |   28184576 | 1994-01-29  |    437397.11 | 324.00
Customer#001207069 |   1207069 |   34201984 | 1997-06-18  |    433879.06 | 322.00
Customer#000773104 |    773104 |   33615872 | 1997-09-28  |    426834.17 | 317.00
Customer#000075070 |     75070 |   43997089 | 1994-08-07  |    424267.21 | 317.00
Customer#000065491 |     65491 |    7549735 | 1994-06-30  |    424178.05 | 315.00
Customer#000144853 |    144853 |   11599171 | 1998-03-22  |    423978.95 | 316.00
Customer#000407243 |    407243 |   19628135 | 1992-01-03  |    420636.78 | 315.00
Customer#001227100 |   1227100 |   35542498 | 1993-10-12  |    417981.24 | 325.00
Customer#001185599 |   1185599 |   54188961 | 1995-06-17  |    407873.05 | 317.00
Customer#001199881 |   1199881 |    1544643 | 1997-09-20  |    406906.07 | 320.00
Customer#001188142 |   1188142 |   42997059 | 1997-03-15  |    404132.92 | 320.00
Customer#001288183 |   1288183 |   48943904 | 1996-07-22  |    398081.59 | 325.00
Customer#000114613 |    114613 |   59930883 | 1997-05-17  |    394335.49 | 319.00
(84 行)

时间: 96647.522 ms
pgdb=# /user1/postgresql/data/q19.txt
pgdb-# \i /user1/postgresql/data/q20.txt
          s_name           |                s_address                 
---------------------------+------------------------------------------
Supplier#000000026        | iV,MHzAx6Z939uzFNkq09M0a1 MBfH7
Supplier#000000035        | QymmGXxjVVQ5OuABCXVVsu,4eF gU0Qc6
Supplier#000000251        | Uqi3s, iqzLxI4duoRfgkciiN4XuCvITGIUf
Supplier#000000253        | DbryhLi6gCv8A P9FkjNp56mLP4KnV9Do
Supplier#000000622        | gCQimU1jYHoQiglDmW1FkQM9wzi YC1P15pMy1
Supplier#000000695        | xhSCyzMl iQ
Supplier#000000731        | dxArCeCKpYV4yBOCZOZb39Y3s7EhIi3d
Supplier#000000760        | ob94rzX66tJ35aKv2jR,inK1
Supplier#000000767        | bHEuqKKdmCMEKOV
Supplier#000000828        | 0B2aPqJ6KTEr2fqxuC7z
Supplier#000000863        | TsC9OuodnybJhWXq4PFNdEJf9jx2y181N3ilV
Supplier#000000941        | gqG2XEnVlzUhjjfQGYGlwk,jcaNsplI8Rleg
Supplier#000000953        | wTTb0ilU6Nba1VLsHj6k0jUt4TFFM6rvtXszzA
Supplier#000000969        | thRdVx7vCajVFs7gsK8VKxzydPiHvIKK,DtR
Supplier#000000973        | 5 nhBZ 03rG6EcOEDkZXvt
Supplier#000001090        | zmTmXSUDDsZhMdPklz8cv9JRplqUgMA
Supplier#000001149        | Nuno37wiZOjNGHF
Supplier#000001201        | Seh4D7pi9UdK,XQkF46A0O2N
Supplier#000001301        | VxrmO6Eyn7uNjaSaiFiPN 3ugFx
Supplier#000001309        | 72RNUzKzbniUnnsSs24ZzGDvmcv2Pd
Supplier#000001351        | zXdoBMmmRx1wOD7GKoHHBtemXGuYKLDb,U2KP
Supplier#000001432        | gIECERmEUGoiGrKmSz
Supplier#000001448        | 3vllw 89Y2IDAE6MbyqjplZ6
Supplier#000001476        | 6MLxydyGdgAuvzTiSmvLRPcIV3693PkAi9A6L3
Supplier#000001481        | ARqVvJHMxBNKl2LrfPsR  Wq9ZUXh,14
Supplier#000001584        | gJbTkijteJxSMLmdzBSzeMAH
Supplier#000001607        | t umXULPQNsFgOks6Ssxp V9y1 EOpYLICa
Supplier#000001637        | 2D8ZlHb5bLmK,YIrlEIOY8R1
Supplier#000001716        | l1HQoaudWVp6
Supplier#000001718        | ,OgZ,mA3MSew1 OJvM6UBn
Supplier#000001821        | 3vDimhSK5SNWns6phih5L3jlZyGW,a,0zhr3
Supplier#000001869        | nogoCdaFQii,ri9rs3P8f5rPt1wVOMw9I7TmypxK
Supplier#000001930        | 2jCSw3KOLHol7y5omVO13
Supplier#000001999        | iMJGJ97d7uZ6d4R7HueaELdtwiuv8oTO
Supplier#000002142        | 5yDT8,tbsgxBG7ojieb97bAky5r5JaLg8icR,y
Supplier#000002214        | 0vXe0cRJIkdIkEQHrFXRXEaGPlPaWO2uOlSaah,
Supplier#000002215        | CI8gUDb,vXUF39Pq6Py
Supplier#000002334        | TRASs4 HRa7BJLxXRms327M
Supplier#000002520        | 5y55UzYQKByZP3
Supplier#000002529        | isvgJhjULHVI
Supplier#000002538        | fz2MZDQNk0sls
Supplier#000002550        | 2DZFnvi1 nXSreP
Supplier#000002643        | eDN6YjGtp2dcj0IF,BKEEYjElO,sUjjcNI
Supplier#000002655        | i6v8dkQBuK0NSCeqQCE8
Supplier#000002857        | 7 Hhv9CYdw,CJJNT
Supplier#000002888        | 3AtRoxBFh6HIBa9kdBX,6,Ml2SZGUA
Supplier#000002927        | La5H5k861WZ
Supplier#000003015        | sMfAdl5XgLeFoiL
Supplier#000003140        | ZUyGRGQ rApQ7CHuglVlEsk 91w
Supplier#000003277        | zW97hQ0M0JqUf7b3GDvsHkYMS
Supplier#000003452        | 7tMycIKhE,pe4OL3Du
Supplier#000003475        | WK9,iCi6p6A9,2Eu Gl
Supplier#000003555        | mx1puagouYCETNPNERVuC5lBMWz
Supplier#000003666        | ENS fE9iSrSzw,iTwA,zGorkflw
Supplier#000003707        | E y,Bok1gTKqdaSdnA9
Supplier#000003773        | UWjSotAjkAD
Supplier#000003818        | KD65BupNh6SuX9EFebFNWoO
Supplier#000003862        | 0XXFhF1IDBh
Supplier#000004007        | cvlSgCCKGOwpaB iFIPx4vU2qA5b6K hz9Z91
Supplier#000004023        | tVt87IttC0pixFV,kybPakPz1Hal, qMDfOo5
Supplier#000004083        | ag x rRbSF61
Supplier#000004104        | GeXZl1DKV33wMLSDvknEXiX6GIvg4
Supplier#000004174        | Bk97olQYwXmjYdQjwyt N
Supplier#000004191        | 8DVAQePX6TmTP
Supplier#000004290        | B9mCZlnMEegzxyWCQKoCZu Vjmh,2VUoxQB7I
Supplier#000004322        | nYtHA4IrK0n
Supplier#000004328        | euddbWZRcVMD3W
Supplier#000004341        | ea8KZYvO7amq8A
Supplier#000004360        | w 7kM5J,fqjiqBu4SU0UPEDqspaUEm
Supplier#000004372        | FbNBgnxh4UOgflhmx2rwlk,NsibLhiS2v2P,wCBT
Supplier#000004375        | Cmr952zcJJuW0xAYc0W0MA7N6vMcCjy
Supplier#000004395        | Pxu,IsRZET0 9ToLGbn1s6aYJ60wCZQ
Supplier#000004398        | khZZ0CmLip49Zncec
Supplier#000004486        | 3pRN44BCE5KHVsPFfSVlZ4I1lkqL NFudA
Supplier#000004599        | 2l OlFEd9pU4Qv2gjjGPySzp
Supplier#000004657        | gDxp,eYee87QHUhpvGG7
Supplier#000004671        | GxMjbOOYNQa1I5r4q7MR
Supplier#000004697        | E5HN7GuWngwcN4Xa
Supplier#000004717        | H,Suh5pN230Ol,ggx0QEh3rrvzyQsq050Lat
Supplier#000004725        | qas7l mIPknKZ
Supplier#000004763        | W 7kS9LLh4ZgLpk2
Supplier#000004796        | ZHE3YL7wX9nvhnKBG,M
Supplier#000004882        | e,V Bo1KZEt
Supplier#000005064        | hcWgbbogD9a1V FaY402Bakl
Supplier#000005199        | xMIKy6lAtw
Supplier#000005238        | jmtI76 8RNG8Z2BZu
Supplier#000005289        | 62XeOur9SnXgbdjGwb9E1aJIEBr5PA9
Supplier#000005308        | 9Ew1qiEgz2BP4DU6qfabYI9kJB60
Supplier#000005362        | VY0I5sfYoL
Supplier#000005379        | 9V7hKSGNOUxDp3gLft0I,rg0j5xzs
Supplier#000005429        | zMag7VEnYBZaYeZbsby
Supplier#000005449        | fhc8lUuZdqWUujcVaWogowEq1WVL9Y8m1efwCl3G
Supplier#000005548        | C7CwN6SZ0ikFPW
Supplier#000005661        | pq5wuxmkIW0DyWU
/user1/postgresql/data/q21.txt
Pattern not found
时间: 7877.500 ms
pgdb-# \i /user1/postgresql/data/q22.txt
cntrycode | numcust | totacctbal  
-----------+---------+-------------
10        |    9053 | 67752399.56
11        |    9006 | 67894525.19
19        |    9078 | 68177380.15
20        |    9240 | 69425181.57
22        |    8990 | 67271840.24
26        |    9013 | 67705001.84
27        |    9006 | 67600913.56
(7 行)

时间: 5719.597 ms
pgdb-#

pgdb-# \i /user1/postgresql/data/q3.txt
l_orderkey |   revenue   | o_orderdate | o_shippriority
------------+-------------+-------------+----------------
   21996356 | 429022.2405 | 1995-03-26  |              0
   31617348 | 427014.3344 | 1995-03-27  |              0
   47577254 | 426741.3390 | 1995-03-18  |              0
   21404195 | 424534.2231 | 1995-03-25  |              0
   35312039 | 422403.5320 | 1995-03-05  |              0
   34684896 | 417863.0392 | 1995-03-11  |              0
   34575136 | 413225.0126 | 1995-03-26  |              0
   47741510 | 412126.9054 | 1995-03-09  |              0
   46891527 | 411812.3222 | 1995-03-25  |              0
   11646177 | 410971.5546 | 1995-03-16  |              0
(10 行)

时间: 51250.171 ms
pgdb-# \i /user1/postgresql/data/q10.txt
c_custkey |       c_name       |   revenue   | c_acctbal |          n_name           |               c_address               |     c_phone     |                                                   c_comment                                                   
-----------+--------------------+-------------+-----------+---------------------------+---------------------------------------+-----------------+----------------------------------------------------------------------------------------------------------------
     29581 | Customer#000029581 | 783023.0226 |   -629.61 | ARGENTINA                 | t2GMv bgtIVPb4towKYQKBs6EGh,1s7BRf    | 11-133-736-8171 | . quickly final accounts wake since the even instructions. regular, permanent accounts are against the final p
     76033 | Customer#000076033 | 777093.4350 |   -718.33 | ALGERIA                   | TqJsSBmjyoU0f8oXBMuqB9CQ7XB6XfZOpGL   | 10-645-182-3231 | ay after the excuses. idly even accounts cajole slyly even dependencies; bold requests along the fo
     12559 | Customer#000012559 | 774645.0702 |   4544.71 | ALGERIA                   | CeDTUfnkc6gFtSczzZdU8GBB5M63RsKA EQq  | 10-393-903-4435 |  to the bold foxes. fluffily express pinto beans sleep rut
    518650 | Customer#000518650 | 755754.2812 |   1301.52 | JORDAN                    | FpRAPcdbM,R9                          | 23-844-399-3555 | ronic theodolites affix carefully pending deposits. furiously silent th
     73009 | Customer#000073009 | 755147.0832 |   3672.96 | INDONESIA                 | I2DrfNjsLvlIdqFdRS5alxUccyCtlfUIR     | 19-448-422-5320 | g excuses? ironic, regular excuses wake slyly along
   1192936 | Customer#001192936 | 746252.2597 |   -234.16 | RUSSIA                    | dbHH,k2N4MhLVKu9XnJUDiNg              | 32-644-511-4374 | lites. special theodolites sleep carefully above th
   1217080 | Customer#001217080 | 743551.7813 |   1433.07 | IRAQ                      | Cn2SuvW2f79ifa0eOwO0AsBFnOApmPcskqBxr | 21-217-359-4450 | . furiously express accounts run. ironic foxes wake. furiously final
    122269 | Customer#000122269 | 741864.5670 |   9633.10 | EGYPT                     | 6G3yP9tENrVow hO4EQ9FVBQAWQPZwlp      | 14-751-252-2045 | uts lose blithely along the carefully ironic courts. regular request
   1081825 | Customer#001081825 | 726607.0830 |   8857.62 | RUSSIA                    | k5g9X,WwuxurArkV9f2o39KpO,oLFGH       | 32-633-426-2292 | yly ironic dolphins. slyly fin
    434047 | Customer#000434047 | 722019.1570 |   -136.97 | UNITED STATES             | ztDQXRbCkDlxmZXB                      | 34-420-850-3020 | nd the quickly ironic asymptotes. bold, regular waters use slyly across the carefully
    940375 | Customer#000940375 | 716583.2198 |   6942.30 | IRAN                      | v8,h5rcbqRNNFMjL                      | 20-499-624-6444 | ress slowly final requests. unusual
    877852 | Customer#000877852 | 713514.9712 |   -676.04 | FRANCE                    | D0KW9am9RA9zmgJNDzh89LDAVp0VLMK4Vgym  | 16-328-692-6607 | efully final packages sleep blithely. express, unusual theodolites wake about the bold instructions.
   1163617 | Customer#001163617 | 708880.9301 |   1840.89 | IRAQ                      | 9yr2h99xclG2Bj                        | 21-252-822-9416 | kages. slyly regular requests are furiously even notornis. unusual dependen
   1440790 | Customer#001440790 | 705130.8785 |   4687.66 | ARGENTINA                 | wx9IUBdXv,QMjYsqd1lDiRBLC             | 11-873-816-8854 | ess, final requests affix carefully closely even
   1361203 | Customer#001361203 | 696439.9980 |   4883.66 | RUSSIA                    | VaPtbhmoK2HcYyDp3cQOi1eLkY1KM2hUAQiI2 | 32-325-841-7813 | ns among the blithely express packages hinder furiously slyly unusual accounts! quickly special p
    129811 | Customer#000129811 | 695478.0049 |   2454.96 | BRAZIL                    | wxCtrfcbRZNP                          | 12-163-974-8679 | bove the carefully quick deposits. quickly unusual accoun
    316849 | Customer#000316849 | 694108.3440 |   3940.32 | JAPAN                     | 9ELkQix1NuQU9IyVdJ30SO1uh4            | 22-737-317-4236 | ts. silent ideas wake carefully among the ironic accounts. ironic excuses integrate
    900199 | Customer#000900199 | 692994.9538 |    498.39 | INDONESIA                 | JFFrLONQxM6eHQI6xBKJhbXGmj5K7ISpn     | 19-279-757-8505 | even requests haggle slyly against the f
    116299 | Customer#000116299 | 692011.1336 |   -753.07 | CHINA                     | iYhwvk,Nbm64dWOUFIz0AsoJywXSl2IQH     | 28-939-870-9524 |  haggle Tiresias. waters grow carefully. fluffily dogged dolphins sleep regular, ironic requests. perman
    254452 | Customer#000254452 | 689498.7780 |   7459.78 | ROMANIA                   | hcLk7NcxWq                            | 29-487-552-4072 | ggle; carefully bold deposits boost blithely among th
(20 行)

时间: 52223.343 ms
pgdb-# \i /user1/postgresql/data/q17.txt
      avg_yearly      
----------------------
3209202.348571428571
(1 行)

时间: 4029.777 ms
pgdb-# \i /user1/postgresql/data/q21.txt
          s_name           | numwait
---------------------------+---------
Supplier#000024297        |      22
Supplier#000014526        |      21
Supplier#000050896        |      21
Supplier#000051263        |      21
Supplier#000021732        |      20
Supplier#000077039        |      20
Supplier#000091469        |      20
Supplier#000097945        |      20
Supplier#000005792        |      19
Supplier#000006372        |      19
Supplier#000008576        |      19
Supplier#000023020        |      19
Supplier#000030847        |      19
Supplier#000034574        |      19
Supplier#000039817        |      19
Supplier#000062406        |      19
Supplier#000065063        |      19
Supplier#000067630        |      19
Supplier#000079715        |      19
Supplier#000087745        |      19
Supplier#000089865        |      19
Supplier#000000921        |      18
Supplier#000002567        |      18
Supplier#000002966        |      18
Supplier#000003947        |      18
Supplier#000023842        |      18
Supplier#000024695        |      18
Supplier#000030454        |      18
Supplier#000038567        |      18
Supplier#000045549        |      18
Supplier#000056342        |      18
Supplier#000057401        |      18
Supplier#000058783        |      18
Supplier#000067989        |      18
Supplier#000070297        |      18
Supplier#000073047        |      18
Supplier#000076736        |      18
Supplier#000082571        |      18
Supplier#000085357        |      18
Supplier#000087433        |      18
Supplier#000090078        |      18
Supplier#000091984        |      18
Supplier#000096390        |      18
Supplier#000097341        |      18
Supplier#000000269        |      17
Supplier#000001175        |      17
Supplier#000002012        |      17
Supplier#000003135        |      17
Supplier#000005671        |      17
Supplier#000011687        |      17
Supplier#000013642        |      17
Supplier#000013847        |      17
Supplier#000014829        |      17
Supplier#000016447        |      17
Supplier#000017373        |      17
Supplier#000019920        |      17
Supplier#000021054        |      17
Supplier#000021378        |      17
Supplier#000023048        |      17
Supplier#000024372        |      17
Supplier#000027097        |      17
Supplier#000030718        |      17
Supplier#000031076        |      17
Supplier#000034034        |      17
Supplier#000034210        |      17
Supplier#000036686        |      17
Supplier#000037065        |      17
Supplier#000038326        |      17
Supplier#000040027        |      17
Supplier#000044689        |      17
Supplier#000045955        |      17
Supplier#000046085        |      17
Supplier#000046351        |      17
Supplier#000047789        |      17
Supplier#000051112        |      17
Supplier#000051985        |      17
Supplier#000052695        |      17
Supplier#000054151        |      17
Supplier#000056706        |      17
Supplier#000060692        |      17
Supplier#000064139        |      17
Supplier#000065018        |      17
Supplier#000065198        |      17
Supplier#000067040        |      17
Supplier#000068049        |      17
Supplier#000068083        |      17
Supplier#000072296        |      17
Supplier#000074107        |      17
Supplier#000077698        |      17
Supplier#000085875        |      17
Supplier#000088029        |      17
Supplier#000088880        |      17
Supplier#000094467        |      17
Supplier#000098259        |      17
Supplier#000099288        |      17
Supplier#000000207        |      16
Supplier#000000722        |      16
Supplier#000000895        |      16
Supplier#000002744        |      16
Supplier#000005145        |      16
(100 行)

时间: 139480.060 ms
pgdb-#

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
27#
 楼主| 发表于 2011-6-16 07:33 | 只看该作者
-bash-3.2$ date;./psql -d pgdb -f /user1/postgresql/data/q_a.sql -o /user1/postgresql/data/q_a.log;date
2011年 06月 16日 星期四 06:37:25 CST
Timing is on.
Time: 381708.096 ms
Time: 13593.186 ms
Time: 51092.852 ms
Time: 11243.724 ms
Time: 60982.194 ms
Time: 25267.713 ms
Time: 46285.189 ms
Time: 13351.568 ms
Time: 197846.585 ms
Time: 49444.851 ms
Time: 6856.866 ms
Time: 36848.254 ms
Time: 48407.148 ms
Time: 25035.739 ms
Time: 4.456 ms
Time: 53304.458 ms
Time: 1.491 ms
Time: 18002.088 ms
Time: 3930.280 ms
Time: 97068.386 ms
Time: 37516.387 ms
Time: 7486.682 ms
Time: 143849.900 ms
Time: 5600.030 ms
2011年 06月 16日 星期四 06:59:40 CST
-bash-3.2$ date;./psql -d pgdb -f /user1/postgresql/data/qfix.sql -o /user1/postgresql/data/qfix.log;date
2011年 06月 16日 星期四 07:18:57 CST
Timing is on.
Time: 4082.965 ms
Time: 2665.178 ms
Time: 98164.059 ms
Time: 90197.243 ms
Time: 35777.554 ms
Time: 9361.133 ms
Time: 70732.978 ms
Time: 138590.666 ms
Time: 141680.589 ms
Time: 5003.085 ms
2011年 06月 16日 星期四 07:28:53 CST
-bash-3.2$

使用道具 举报

回复
论坛徽章:
5
2012新春纪念徽章
日期:2012-01-04 11:55:05马上有房
日期:2014-04-08 15:43:10妮可·罗宾
日期:2016-07-29 08:53:00
28#
发表于 2011-6-20 16:30 | 只看该作者
楼主辛苦了,做了这么多实验,看着累啊,有啥结论没?俺想直接先看下总结性的文字。

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表