楼主: 〇〇

mysql 5.5 tpc-h测试

[复制链接]
论坛徽章:
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-4 21:20 | 只看该作者
17看这个执行计划,有点悬

mysql> explain -- 17
    -> select
    ->  sum(l_extendedprice) / 7.0 as avg_yearly
    -> from
    ->  lineitem,
    ->  part
    -> where
    ->  p_partkey = l_partkey
    ->  and p_brand = 'Brand#23'
    ->  and p_container = 'MED CAN'
    ->  and l_quantity < (
    ->   select
    ->    0.2 * avg(l_quantity)
    ->   from
    ->    lineitem
    ->   where
    ->    l_partkey = p_partkey
    ->  ) limit  10;
+----+--------------------+----------+--------+---------------+---------+---------+-------------------------+----------+-------------+
| id | select_type        | table    | type   | possible_keys | key     | key_len | ref                     | rows     | Extra       |
+----+--------------------+----------+--------+---------------+---------+---------+-------------------------+----------+-------------+
|  1 | PRIMARY            | lineitem | ALL    | NULL          | NULL    | NULL    | NULL                    | 60070444 |             |
|  1 | PRIMARY            | part     | eq_ref | PRIMARY       | PRIMARY | 4       | tpch.lineitem.l_partkey |        1 | Using where |
|  2 | DEPENDENT SUBQUERY | lineitem | ALL    | NULL          | NULL    | NULL    | NULL                    | 60070444 | Using where |
+----+--------------------+----------+--------+---------------+---------+---------+-------------------------+----------+-------------+
3 rows in set (0.00 sec)

mysql> -- 17
mysql> select
    ->  sum(l_extendedprice) / 7.0 as avg_yearly
    -> from
    ->  lineitem,
    ->  part
    -> where
    ->  p_partkey = l_partkey
    ->  and p_brand = 'Brand#23'
    ->  and p_container = 'MED CAN'
    ->  and l_quantity < (
    ->   select
    ->    0.2 * avg(l_quantity)
    ->   from
    ->    lineitem
    ->   where
    ->    l_partkey = p_partkey
    ->  ) limit  10;

使用道具 举报

回复
论坛徽章:
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-4 21:57 | 只看该作者
果然不行
Ctrl-C -- sending "KILL QUERY 1" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted
mysql> explain -- 18
    -> 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) > 313
    ->  )
    ->  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 limit  10;
+----+--------------------+----------+-------+--------------------+------------+---------+-------------------------+---------+---------------------------------+
| id | select_type        | table    | type  | possible_keys      | key        | key_len | ref                     | rows    | Extra                           |
+----+--------------------+----------+-------+--------------------+------------+---------+-------------------------+---------+---------------------------------+
|  1 | PRIMARY            | customer | ALL   | PRIMARY            | NULL       | NULL    | NULL                    | 1490739 | Using temporary; Using filesort |
|  1 | PRIMARY            | orders   | ref   | PRIMARY,orders_fk1 | orders_fk1 | 4       | tpch.customer.c_custkey |       7 | Using where                     |
|  1 | PRIMARY            | lineitem | ref   | PRIMARY            | PRIMARY    | 4       | tpch.orders.o_orderkey  |       2 |                                 |
|  2 | DEPENDENT SUBQUERY | lineitem | index | NULL               | PRIMARY    | 8       | NULL                    |       2 |                                 |
+----+--------------------+----------+-------+--------------------+------------+---------+-------------------------+---------+---------------------------------+
4 rows in set (0.00 sec)

mysql> -- 18
mysql> 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) > 313
    ->  )
    ->  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 limit  10;

使用道具 举报

回复
论坛徽章:
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-4 22:00 | 只看该作者
Ctrl-C -- sending "KILL QUERY 1" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted
mysql> explain -- 19
    -> select
    ->  sum(l_extendedprice* (1 - l_discount)) as revenue
    -> from
    ->  lineitem,
    ->  part
    -> where
    ->  (
    ->   p_partkey = l_partkey
    ->   and p_brand = 'Brand#31'
    ->   and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
    ->   and l_quantity >= 3 and l_quantity <= 3 + 10
    ->   and p_size between 1 and 5
    ->   and l_shipmode in ('AIR', 'AIR REG')
    ->   and l_shipinstruct = 'DELIVER IN PERSON'
    ->  )
    ->  or
    ->  (
    ->   p_partkey = l_partkey
    ->   and p_brand = 'Brand#21'
    ->   and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
    ->   and l_quantity >= 15 and l_quantity <= 15 + 10
    ->   and p_size between 1 and 10
    ->   and l_shipmode in ('AIR', 'AIR REG')
    ->   and l_shipinstruct = 'DELIVER IN PERSON'
    ->  )
    ->  or
    ->  (
    ->   p_partkey = l_partkey
    ->   and p_brand = 'Brand#45'
    ->   and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
    ->   and l_quantity >= 23 and l_quantity <= 23 + 10
    ->   and p_size between 1 and 15
    ->   and l_shipmode in ('AIR', 'AIR REG')
    ->   and l_shipinstruct = 'DELIVER IN PERSON'
    ->  ) limit  10;
+----+-------------+----------+--------+---------------+---------+---------+-------------------------+----------+-------------+
| id | select_type | table    | type   | possible_keys | key     | key_len | ref                     | rows     | Extra       |
+----+-------------+----------+--------+---------------+---------+---------+-------------------------+----------+-------------+
|  1 | SIMPLE      | lineitem | ALL    | NULL          | NULL    | NULL    | NULL                    | 60070444 | Using where |
|  1 | SIMPLE      | part     | eq_ref | PRIMARY       | PRIMARY | 4       | tpch.lineitem.l_partkey |        1 | Using where |
+----+-------------+----------+--------+---------------+---------+---------+-------------------------+----------+-------------+
2 rows in set (0.00 sec)

mysql> -- 19
mysql> select
    ->  sum(l_extendedprice* (1 - l_discount)) as revenue
    -> from
    ->  lineitem,
    ->  part
    -> where
    ->  (
    ->   p_partkey = l_partkey
    ->   and p_brand = 'Brand#31'
    ->   and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
    ->   and l_quantity >= 3 and l_quantity <= 3 + 10
    ->   and p_size between 1 and 5
    ->   and l_shipmode in ('AIR', 'AIR REG')
    ->   and l_shipinstruct = 'DELIVER IN PERSON'
    ->  )
    ->  or
    ->  (
    ->   p_partkey = l_partkey
    ->   and p_brand = 'Brand#21'
    ->   and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
    ->   and l_quantity >= 15 and l_quantity <= 15 + 10
    ->   and p_size between 1 and 10
    ->   and l_shipmode in ('AIR', 'AIR REG')
    ->   and l_shipinstruct = 'DELIVER IN PERSON'
    ->  )
    ->  or
    ->  (
    ->   p_partkey = l_partkey
    ->   and p_brand = 'Brand#45'
    ->   and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
    ->   and l_quantity >= 23 and l_quantity <= 23 + 10
    ->   and p_size between 1 and 15
    ->   and l_shipmode in ('AIR', 'AIR REG')
    ->   and l_shipinstruct = 'DELIVER IN PERSON'
    ->  ) limit  10;
+---------------+
| revenue       |
+---------------+
| 35382266.2072 |
+---------------+
1 row in set (1 min 0.31 sec)

mysql>

使用道具 举报

回复
论坛徽章:
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-4 22:23 | 只看该作者
mysql> explain -- 20
    -> select
    ->  s_name,
    ->  s_address
    -> from
    ->  supplier,
    ->  nation
    -> where
    ->  s_suppkey in (
    ->   select
    ->    ps_suppkey
    ->   from
    ->    partsupp
    ->   where
    ->    ps_partkey in (
    ->     select
    ->      p_partkey
    ->     from
    ->      part
    ->     where
    ->      p_name like 'bisque%'
    ->    )
    ->    and ps_availqty > (
    ->     select
    ->      0.5 * sum(l_quantity)
    ->     from
    ->      lineitem
    ->     where
    ->      l_partkey = ps_partkey
    ->      and l_suppkey = ps_suppkey
    ->      and l_shipdate >= date '1994-01-01'
    ->      and l_shipdate < date '1994-01-01' + interval '1' year
    ->    )
    ->  )
    ->  and s_nationkey = n_nationkey
    ->  and n_name = 'CANADA'
    -> order by
    ->  s_name limit  10;
+----+--------------------+----------+-----------------+---------------+--------------+---------+---------------------------+----------+-----------------------------+
| id | select_type        | table    | type            | possible_keys | key          | key_len | ref                       | rows     | Extra                       |
+----+--------------------+----------+-----------------+---------------+--------------+---------+---------------------------+----------+-----------------------------+
|  1 | PRIMARY            | supplier | ALL             | supplier_fk1  | NULL         | NULL    | NULL                      |    99766 | Using where; Using filesort |
|  1 | PRIMARY            | nation   | eq_ref          | PRIMARY       | PRIMARY      | 4       | tpch.supplier.s_nationkey |        1 | Using where                 |
|  2 | DEPENDENT SUBQUERY | partsupp | index_subquery  | partsupp_fk1  | partsupp_fk1 | 4       | func                      |       42 | Using where                 |
|  4 | DEPENDENT SUBQUERY | lineitem | ALL             | NULL          | NULL         | NULL    | NULL                      | 60070444 | Using where                 |
|  3 | DEPENDENT SUBQUERY | part     | unique_subquery | PRIMARY       | PRIMARY      | 4       | func                      |        1 | Using where                 |
+----+--------------------+----------+-----------------+---------------+--------------+---------+---------------------------+----------+-----------------------------+
5 rows in set (0.00 sec)

mysql> -- 20
mysql> select
    ->  s_name,
    ->  s_address
    -> from
    ->  supplier,
    ->  nation
    -> where
    ->  s_suppkey in (
    ->   select
    ->    ps_suppkey
    ->   from
    ->    partsupp
    ->   where
    ->    ps_partkey in (
    ->     select
    ->      p_partkey
    ->     from
    ->      part
    ->     where
    ->      p_name like 'bisque%'
    ->    )
    ->    and ps_availqty > (
    ->     select
    ->      0.5 * sum(l_quantity)
    ->     from
    ->      lineitem
    ->     where
    ->      l_partkey = ps_partkey
    ->      and l_suppkey = ps_suppkey
    ->      and l_shipdate >= date '1994-01-01'
    ->      and l_shipdate < date '1994-01-01' + interval '1' year
    ->    )
    ->  )
    ->  and s_nationkey = n_nationkey
    ->  and n_name = 'CANADA'
    -> order by
    ->  s_name limit  10;
Ctrl-C -- sending "KILL QUERY 1" to server ...
Ctrl-C -- query aborted.
ERROR 1317 (70100): Query execution was interrupted
mysql> explain -- 21
    -> 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 = 'GERMANY'
    -> group by
    ->  s_name
    -> order by
    ->  numwait desc,
    ->  s_name limit  10;
+----+--------------------+----------+--------+----------------------+---------+---------+---------------------------+----------+----------------------------------------------+
| id | select_type        | table    | type   | possible_keys        | key     | key_len | ref                       | rows     | Extra                                        |
+----+--------------------+----------+--------+----------------------+---------+---------+---------------------------+----------+----------------------------------------------+
|  1 | PRIMARY            | orders   | ALL    | PRIMARY              | NULL    | NULL    | NULL                      | 15016933 | Using where; Using temporary; Using filesort |
|  1 | PRIMARY            | l1       | ref    | PRIMARY              | PRIMARY | 4       | tpch.orders.o_orderkey    |        2 | Using where                                  |
|  1 | PRIMARY            | supplier | eq_ref | PRIMARY,supplier_fk1 | PRIMARY | 4       | tpch.l1.l_suppkey         |        1 |                                              |
|  1 | PRIMARY            | nation   | eq_ref | PRIMARY              | PRIMARY | 4       | tpch.supplier.s_nationkey |        1 | Using where                                  |
|  3 | DEPENDENT SUBQUERY | l3       | ref    | PRIMARY              | PRIMARY | 4       | tpch.l1.l_orderkey        |        2 | Using where                                  |
|  2 | DEPENDENT SUBQUERY | l2       | ref    | PRIMARY              | PRIMARY | 4       | tpch.l1.l_orderkey        |        2 | Using where                                  |
+----+--------------------+----------+--------+----------------------+---------+---------+---------------------------+----------+----------------------------------------------+
6 rows in set (0.01 sec)

mysql> -- 21
mysql> 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 = 'GERMANY'
    -> group by
    ->  s_name
    -> order by
    ->  numwait desc,
    ->  s_name limit  10;
+--------------------+---------+
| s_name             | numwait |
+--------------------+---------+
| Supplier#000007962 |      22 |
| Supplier#000033421 |      22 |
| Supplier#000018276 |      21 |
| Supplier#000028758 |      21 |
| Supplier#000090945 |      21 |
| Supplier#000014045 |      20 |
| Supplier#000014173 |      20 |
| Supplier#000017352 |      20 |
| Supplier#000025900 |      20 |
| Supplier#000032900 |      20 |
+--------------------+---------+
10 rows in set (3 min 25.31 sec)

mysql>

使用道具 举报

回复
论坛徽章:
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-4 22:24 | 只看该作者
mysql> explain -- 22
    -> select
    ->  cntrycode,
    ->  count(*) as numcust,
    ->  sum(c_acctbal) as totacctbal
    -> from
    ->  (
    ->   select
    ->    substr(c_phone ,1 ,2) as cntrycode,
    ->    c_acctbal
    ->   from
    ->    customer
    ->   where
    ->    substr(c_phone ,1 ,2) in
    ->     ('23', '39', '40', '27', '33', '31', '25')
    ->    and c_acctbal > (
    ->     select
    ->      avg(c_acctbal)
    ->     from
    ->      customer
    ->     where
    ->      c_acctbal > 0.00
    ->      and substr(c_phone ,1 ,2) in
    ->       ('23', '39', '40', '27', '33', '31', '25')
    ->    )
    ->    and not exists (
    ->     select
    ->      *
    ->     from
    ->      orders
    ->     where
    ->      o_custkey = c_custkey
    ->    )
    ->  ) custsale
    -> group by
    ->  cntrycode
    -> order by
    ->  cntrycode limit  10;
+----+--------------------+------------+------+---------------+------------+---------+-------------------------+---------+---------------------------------+
| id | select_type        | table      | type | possible_keys | key        | key_len | ref                     | rows    | Extra                           |
+----+--------------------+------------+------+---------------+------------+---------+-------------------------+---------+---------------------------------+
|  1 | PRIMARY            | <derived2> | ALL  | NULL          | NULL       | NULL    | NULL                    |   45382 | Using temporary; Using filesort |
|  2 | DERIVED            | customer   | ALL  | NULL          | NULL       | NULL    | NULL                    | 1490739 | Using where                     |
|  4 | DEPENDENT SUBQUERY | orders     | ref  | orders_fk1    | orders_fk1 | 4       | tpch.customer.c_custkey |       7 | Using index                     |
|  3 | SUBQUERY           | customer   | ALL  | NULL          | NULL       | NULL    | NULL                    | 1490739 | Using where                     |
+----+--------------------+------------+------+---------------+------------+---------+-------------------------+---------+---------------------------------+
4 rows in set (2.87 sec)

mysql> -- 22
mysql> select
    ->  cntrycode,
    ->  count(*) as numcust,
    ->  sum(c_acctbal) as totacctbal
    -> from
    ->  (
    ->   select
    ->    substr(c_phone ,1 ,2) as cntrycode,
    ->    c_acctbal
    ->   from
    ->    customer
    ->   where
    ->    substr(c_phone ,1 ,2) in
    ->     ('23', '39', '40', '27', '33', '31', '25')
    ->    and c_acctbal > (
    ->     select
    ->      avg(c_acctbal)
    ->     from
    ->      customer
    ->     where
    ->      c_acctbal > 0.00
    ->      and substr(c_phone ,1 ,2) in
    ->       ('23', '39', '40', '27', '33', '31', '25')
    ->    )
    ->    and not exists (
    ->     select
    ->      *
    ->     from
    ->      orders
    ->     where
    ->      o_custkey = c_custkey
    ->    )
    ->  ) custsale
    -> group by
    ->  cntrycode
    -> order by
    ->  cntrycode limit  10;
+-----------+---------+-------------+
| cntrycode | numcust | totacctbal  |
+-----------+---------+-------------+
| 23        |    8988 | 67627762.48 |
| 25        |    9111 | 68360817.05 |
| 27        |    9014 | 67640913.65 |
| 31        |    9087 | 68149522.82 |
| 33        |    9182 | 68895118.67 |
+-----------+---------+-------------+
5 rows in set (2.81 sec)

mysql>

使用道具 举报

回复
论坛徽章:
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-5 08:59 | 只看该作者
居然有缓存

mysql> source /root/qall_my1-16.sql
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(3)
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus ' at line 15
+-----------+--------------------+---------------+-----------+----------------+------------------------------------------+-----------------+-----------------------------------------------------------------------------------------------------+
| s_acctbal | s_name             | n_name        | p_partkey | p_mfgr         | s_address                                | s_phone         | s_comment                                                                                           |
+-----------+--------------------+---------------+-----------+----------------+------------------------------------------+-----------------+-----------------------------------------------------------------------------------------------------+
|   9997.03 | Supplier#000021474 | UNITED STATES |    746452 | Manufacturer#3 | B1WCuHtuY5Lm4bj,S                        | 34-502-253-8876 | posits are. regular braids about th                                                                 |
|   9996.13 | Supplier#000048428 | CANADA        |    873403 | Manufacturer#2 | Z,m5TgvRq7oG4rsmvnE9Bn nemmJff54FkFAgk   | 13-611-820-5223 | eodolites along the ideas de                                                                        |
|   9994.95 | Supplier#000036836 | BRAZIL        |   1436835 | Manufacturer#5 | HJF6WNqa,jTyW8LiX0dU2dmN8YmR tg          | 12-420-313-3017 | eful, special instructions. ironic, blithe theodolites nag quickly pending requests. quiet, even ac |
|   9994.83 | Supplier#000052301 | CANADA        |    202296 | Manufacturer#5 | tEE5cTg1Xv3tOKaAhfMfCDfybQFISdtt8V       | 13-437-784-3548 | re always instructions. ideas must have to detec                                                    |
|   9992.28 | Supplier#000060858 | ARGENTINA     |   1010837 | Manufacturer#3 | JY6ikmxTyvQlWD1nhvSygO6QptwWc9YG3vylw    | 11-719-537-8037 | ithely idle deposits detect furiously about the even package                                        |
|   9990.67 | Supplier#000090925 | UNITED STATES |   1640892 | Manufacturer#1 | oFEr9GkQpXQw72 W4Y2DPLmQvIAGHPXMSF1H3p   | 34-606-851-5651 | ly even requests. even courts sleep slyly busily final ideas. carefully sly theodolites             |
|   9989.90 | Supplier#000011269 | BRAZIL        |    686262 | Manufacturer#4 | V,4bksZDdE1Ux3YhH1UE0SeGZjudbbVvb,H3eA 3 | 12-917-310-3275 | egular accounts after the furiously express requests doubt above the slyly                          |
|   9989.46 | Supplier#000037658 | UNITED STATES |    462645 | Manufacturer#5 | SEh9v7C6WXZo855C5hu6sbkpRni72No          | 34-919-304-8360 | the instructions are furiously even requests.                                                       |
|   9988.34 | Supplier#000023569 | ARGENTINA     |     48568 | Manufacturer#3 | EZlxYBTNi,J1HLwEjPUhrlgnB IB2Ale         | 11-410-115-9353 | lly pending requests boost furiously. deposits across the fluffily unusual sentiments detect acr    |
|   9987.04 | Supplier#000015601 | PERU          |   1890582 | Manufacturer#5 | 2UvlYtOSEoYOCYrgeWxjeIn7NLnx             | 27-993-727-8949 | ronic platelets. final asymptotes affix. silent packages ca                                         |
+-----------+--------------------+---------------+-----------+----------------+------------------------------------------+-----------------+-----------------------------------------------------------------------------------------------------+
10 rows in set (0.00 sec)

+------------+-------------+-------------+----------------+
| l_orderkey | revenue     | o_orderdate | o_shippriority |
+------------+-------------+-------------+----------------+
|   21679558 | 451192.3341 | 1995-01-17  |              0 |
|   57978848 | 450250.4648 | 1995-02-19  |              0 |
|   24295076 | 437186.7777 | 1995-01-05  |              0 |
|   23679299 | 428116.4351 | 1995-02-28  |              0 |
|     492164 | 423270.2092 | 1995-02-19  |              0 |
|   35312039 | 422403.5320 | 1995-03-05  |              0 |
|     820962 | 418407.3101 | 1995-02-11  |              0 |
|   26731940 | 417950.7043 | 1995-02-27  |              0 |
|   36065633 | 417908.8665 | 1995-02-19  |              0 |
|   51262022 | 413274.3434 | 1995-02-11  |              0 |
+------------+-------------+-------------+----------------+
10 rows in set (0.00 sec)

+-----------------+-------------+
| o_orderpriority | order_count |
+-----------------+-------------+
| 1-URGENT        |      105597 |
| 2-HIGH          |      105754 |
| 3-MEDIUM        |      105026 |
| 4-NOT SPECIFIED |      104819 |
| 5-LOW           |      105309 |
+-----------------+-------------+
5 rows in set (0.00 sec)

+------------+----------------+
| n_name     | revenue        |
+------------+----------------+
| MOROCCO    | 540038731.8977 |
| KENYA      | 536052927.7305 |
| ETHIOPIA   | 520384942.7652 |
| MOZAMBIQUE | 520109603.6710 |
| ALGERIA    | 519498315.2213 |
+------------+----------------+
5 rows in set (0.00 sec)

+-----------------+
| revenue         |
+-----------------+
| 2014944457.3560 |
+-----------------+
1 row in set (0.00 sec)

+----------------+----------------+--------+----------------+
| supp_nation    | cust_nation    | l_year | revenue        |
+----------------+----------------+--------+----------------+
| ROMANIA        | UNITED KINGDOM |   1995 | 529821664.1735 |
| ROMANIA        | UNITED KINGDOM |   1996 | 541319833.0274 |
| UNITED KINGDOM | ROMANIA        |   1995 | 528819804.2166 |
| UNITED KINGDOM | ROMANIA        |   1996 | 525485490.0643 |
+----------------+----------------+--------+----------------+
4 rows in set (0.00 sec)

+--------+------------+
| o_year | mkt_share  |
+--------+------------+
|   1995 | 0.03780949 |
|   1996 | 0.03851161 |
+--------+------------+
2 rows in set (0.00 sec)

+-----------+--------+----------------+
| nation    | o_year | sum_profit     |
+-----------+--------+----------------+
| ALGERIA   |   1998 | 352822350.0693 |
| ALGERIA   |   1997 | 596671435.2478 |
| ALGERIA   |   1996 | 602177243.0192 |
| ALGERIA   |   1995 | 606831210.8801 |
| ALGERIA   |   1994 | 595415097.2158 |
| ALGERIA   |   1993 | 601347225.0045 |
| ALGERIA   |   1992 | 594128993.7166 |
| ARGENTINA |   1998 | 366005512.6697 |
| ARGENTINA |   1997 | 614815785.9445 |
| ARGENTINA |   1996 | 621181784.9130 |
+-----------+--------+----------------+
10 rows in set (0.00 sec)

+-----------+--------------------+-------------+-----------+----------------+------------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+
| c_custkey | c_name             | revenue     | c_acctbal | n_name         | c_address                                | c_phone         | c_comment                                                                                               |
+-----------+--------------------+-------------+-----------+----------------+------------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+
|    859087 | Customer#000859087 | 795591.1319 |   4009.94 | PERU           | i VYSwydv M5ss0b                         | 27-458-775-5124 | the enticingly regular packages. fluffily                                                               |
|    740428 | Customer#000740428 | 774058.5652 |   8832.45 | UNITED KINGDOM | f6GR6VnLK,yXj8mxGUIwXBh6R                | 33-486-888-6888 | ual, even dependencies are. s                                                                           |
|   1121018 | Customer#001121018 | 771017.7419 |    440.07 | FRANCE         | kymXkSpb2QJwM0fyG5akNjEpABQ6KMVL         | 16-979-738-3029 |  gifts. blithely final pinto beans above the ironic requests cajole after the spe                       |
|    940558 | Customer#000940558 | 757257.8295 |   9296.89 | IRAQ           | rbUTQJaBKK                               | 21-412-697-1127 | l accounts use. quickly ironic platelets according to the bold courts use fluffily along                |
|    626548 | Customer#000626548 | 741637.4629 |   8816.29 | CANADA         | wC,cqFOqmayHMp5wsz9                      | 13-108-148-1920 | ites haggle carefully quickly final packages. slyly unusual instructions are. furiously pending depos   |
|    176566 | Customer#000176566 | 740436.4792 |   6653.77 | IRAQ           | P6cScNofcMOgN                            | 21-481-935-8112 | nts. even platelets about the slyly pending theodoli                                                    |
|    398209 | Customer#000398209 | 737423.6546 |   8078.60 | BRAZIL         | Np9BZBmhKjnV2RyVJDRu3VN2                 | 12-677-416-7086 | s requests. carefully idle pinto beans impress. regular, ironic deposits cajole final deposits. furious |
|    105427 | Customer#000105427 | 733099.2779 |   1913.89 | FRANCE         | VNa1DaHYUaS5j                            | 16-588-422-6089 | e blithely instructions. ironic tithes sleep furiously through the fluf                                 |
|   1427804 | Customer#001427804 | 726550.3773 |   5641.37 | ETHIOPIA       | w24QdAVFSER                              | 15-973-207-5120 |  boost slyly alongside of the daring deposits. dependencies us                                          |
|    365584 | Customer#000365584 | 721747.2564 |   7085.64 | CANADA         | LsxxTCJ2nGrptdL                          | 13-881-145-1128 | s packages. slyly regular patterns boost bold, unusual accounts.                                        |
|   1391057 | Customer#001391057 | 707403.3930 |   -956.13 | ETHIOPIA       | wU4WfTvm3zsH99                           | 15-744-116-1290 | tes use waters. fluffily special ideas along the regular, ironic                                        |
|   1081033 | Customer#001081033 | 697514.1760 |   8912.66 | VIETNAM        | kc17y n5axGKI7vtZZYyPN, 3KURHDzNL5snT    | 31-738-534-2032 | he fluffily regular pinto beans. deposits detect thinly.                                                |
|    744874 | Customer#000744874 | 696698.6251 |    269.30 | CHINA          | J6yHXhjiLifQYl6S, wNzAWj9QmY4            | 28-380-324-8315 | ld dugouts nag furiously after the always unusual theodolites. quickly unusual                          |
|   1177250 | Customer#001177250 | 695476.5153 |   -622.72 | ROMANIA        | qGZWM0sT8ZUXZ                            | 29-104-754-1207 | dolites sleep quickly ironic packages. silent packages haggle carefully                                 |
|    901693 | Customer#000901693 | 694203.9166 |   4822.73 | VIETNAM        | o0EVo9buBfc5ZY,gi4VFvXjWR,qJNhjPHXvx mtY | 31-623-126-9286 | ages sleep above the slyly regular requests. carefully even theodolites after the special, bold accoun  |
|   1478164 | Customer#001478164 | 692618.5550 |   9128.79 | IRAN           | 2vy4nYJ,WD y0uz7uMvtcRmT2D8HSt4S9CbF     | 20-455-516-1410 | usly furiously regular pinto beans. blithely i                                                          |
|    236758 | Customer#000236758 | 691176.2952 |   8416.76 | ROMANIA        | z eZsbos p u                             | 29-844-815-1064 | eep furiously: pending deposits boost carefully even, final excuses. even, pendi                        |
|    553184 | Customer#000553184 | 690088.7148 |   5826.55 | SAUDI ARABIA   | ir9Q2bjnZilhFoS8gH4I3                    | 30-599-126-7708 | lyly thin forges cajole slyly? regular deposits according to the special, express notornis cajole       |
|   1459033 | Customer#001459033 | 683803.2768 |   9049.44 | INDONESIA      | ZtmMQwHl3OEEmRMFIeRTDuQhEuDVNaQIl31a     | 19-680-834-9042 | he slyly bold accounts. carefully ironic foxes cajole bravely                                           |
|     57454 | Customer#000057454 | 677202.9870 |   9740.34 | ETHIOPIA       | 3UuMxx1kC9yhoWNVszz7zfVN9817toLaS        | 15-589-139-5007 | e fluffily. express foxes among the slyly final in                                                      |
+-----------+--------------------+-------------+-----------+----------------+------------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+
20 rows in set (0.00 sec)

Empty set (0.00 sec)

+------------+-----------------+----------------+
| l_shipmode | high_line_count | low_line_count |
+------------+-----------------+----------------+
| FOB        |           62738 |          93486 |
| MAIL       |           62206 |          93979 |
+------------+-----------------+----------------+
2 rows in set (0.00 sec)

+---------+----------+
| c_count | custdist |
+---------+----------+
|       0 |   500023 |
|      10 |    65974 |
|       9 |    65196 |
|      11 |    62247 |
|       8 |    58373 |
|      12 |    55809 |
|      13 |    49853 |
|       7 |    46762 |
|      19 |    46735 |
|      18 |    46216 |
+---------+----------+
10 rows in set (0.01 sec)

+---------------+
| promo_revenue |
+---------------+
| 16.6088216759 |
+---------------+
1 row in set (0.00 sec)

+-----------+--------------------+---------------------+-----------------+---------------+
| s_suppkey | s_name             | s_address           | s_phone         | total_revenue |
+-----------+--------------------+---------------------+-----------------+---------------+
|     83966 | Supplier#000083966 | 0ITp9HCIUHEHgWCjeTt | 24-897-113-5492 |  2147201.6871 |
+-----------+--------------------+---------------------+-----------------+---------------+
1 row in set (0.00 sec)

+----------+---------------------------+--------+--------------+
| p_brand  | p_type                    | p_size | supplier_cnt |
+----------+---------------------------+--------+--------------+
| Brand#33 | STANDARD BURNISHED COPPER |     42 |          116 |
| Brand#51 | PROMO PLATED STEEL        |     28 |          104 |
| Brand#11 | ECONOMY ANODIZED COPPER   |     28 |          100 |
| Brand#42 | PROMO BURNISHED NICKEL    |     27 |          100 |
| Brand#11 | ECONOMY POLISHED COPPER   |     41 |           99 |
| Brand#51 | ECONOMY PLATED NICKEL     |     10 |           96 |
| Brand#14 | ECONOMY PLATED COPPER     |     42 |           95 |
| Brand#43 | MEDIUM PLATED NICKEL      |     28 |           95 |
| Brand#11 | LARGE POLISHED COPPER     |     10 |           92 |
| Brand#15 | ECONOMY BURNISHED NICKEL  |     28 |           92 |
+----------+---------------------------+--------+--------------+
10 rows in set (0.00 sec)

mysql>

使用道具 举报

回复
论坛徽章:
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-5 09:50 | 只看该作者
mysql> show variables like '%query_cache%';
+------------------------------+----------+
| Variable_name                | Value    |
+------------------------------+----------+
| have_query_cache             | YES      |
| query_cache_limit            | 2097152  |
| query_cache_min_res_unit     | 4096     |
| query_cache_size             | 67108864 |
| query_cache_type             | ON       |
| query_cache_wlock_invalidate | OFF      |
+------------------------------+----------+
6 rows in set (0.00 sec)

mysql> flush tables ;
Query OK, 0 rows affected (0.00 sec)

mysql> source /root/qall_my1-16.sql

使用道具 举报

回复
论坛徽章:
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
28#
 楼主| 发表于 2011-6-5 09:57 | 只看该作者
mysql> source /root/qall_my1-16.sql
+--------------+--------------+--------------+------------------+--------------------+----------------------+-----------+--------------+----------+-------------+
| 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.500975 | 38237.151009 | 0.050007 |    14804077 |
| N            | F            |   9851614.00 |   14767438399.17 |   14028805792.2114 |   14590490998.366737 | 25.522448 | 38257.810660 | 0.049973 |      385998 |
| N            | O            | 750440706.00 | 1125264325266.58 | 1068995512488.7987 | 1111768538120.324852 | 25.498259 | 38233.907986 | 0.050000 |    29431057 |
| R            | F            | 377732830.00 |  566431054976.00 |  538110922664.7677 |  559634780885.086257 | 25.508385 | 38251.219274 | 0.049997 |    14808183 |
+--------------+--------------+--------------+------------------+--------------------+----------------------+-----------+--------------+----------+-------------+
4 rows in set (4 min 10.07 sec)

+-----------+--------------------+---------------+-----------+----------------+------------------------------------------+-----------------+-----------------------------------------------------------------------------------------------------+
| s_acctbal | s_name             | n_name        | p_partkey | p_mfgr         | s_address                                | s_phone         | s_comment                                                                                           |
+-----------+--------------------+---------------+-----------+----------------+------------------------------------------+-----------------+-----------------------------------------------------------------------------------------------------+
|   9997.03 | Supplier#000021474 | UNITED STATES |    746452 | Manufacturer#3 | B1WCuHtuY5Lm4bj,S                        | 34-502-253-8876 | posits are. regular braids about th                                                                 |
|   9996.13 | Supplier#000048428 | CANADA        |    873403 | Manufacturer#2 | Z,m5TgvRq7oG4rsmvnE9Bn nemmJff54FkFAgk   | 13-611-820-5223 | eodolites along the ideas de                                                                        |
|   9994.95 | Supplier#000036836 | BRAZIL        |   1436835 | Manufacturer#5 | HJF6WNqa,jTyW8LiX0dU2dmN8YmR tg          | 12-420-313-3017 | eful, special instructions. ironic, blithe theodolites nag quickly pending requests. quiet, even ac |
|   9994.83 | Supplier#000052301 | CANADA        |    202296 | Manufacturer#5 | tEE5cTg1Xv3tOKaAhfMfCDfybQFISdtt8V       | 13-437-784-3548 | re always instructions. ideas must have to detec                                                    |
|   9992.28 | Supplier#000060858 | ARGENTINA     |   1010837 | Manufacturer#3 | JY6ikmxTyvQlWD1nhvSygO6QptwWc9YG3vylw    | 11-719-537-8037 | ithely idle deposits detect furiously about the even package                                        |
|   9990.67 | Supplier#000090925 | UNITED STATES |   1640892 | Manufacturer#1 | oFEr9GkQpXQw72 W4Y2DPLmQvIAGHPXMSF1H3p   | 34-606-851-5651 | ly even requests. even courts sleep slyly busily final ideas. carefully sly theodolites             |
|   9989.90 | Supplier#000011269 | BRAZIL        |    686262 | Manufacturer#4 | V,4bksZDdE1Ux3YhH1UE0SeGZjudbbVvb,H3eA 3 | 12-917-310-3275 | egular accounts after the furiously express requests doubt above the slyly                          |
|   9989.46 | Supplier#000037658 | UNITED STATES |    462645 | Manufacturer#5 | SEh9v7C6WXZo855C5hu6sbkpRni72No          | 34-919-304-8360 | the instructions are furiously even requests.                                                       |
|   9988.34 | Supplier#000023569 | ARGENTINA     |     48568 | Manufacturer#3 | EZlxYBTNi,J1HLwEjPUhrlgnB IB2Ale         | 11-410-115-9353 | lly pending requests boost furiously. deposits across the fluffily unusual sentiments detect acr    |
|   9987.04 | Supplier#000015601 | PERU          |   1890582 | Manufacturer#5 | 2UvlYtOSEoYOCYrgeWxjeIn7NLnx             | 27-993-727-8949 | ronic platelets. final asymptotes affix. silent packages ca                                         |
+-----------+--------------------+---------------+-----------+----------------+------------------------------------------+-----------------+-----------------------------------------------------------------------------------------------------+
10 rows in set (2.54 sec)

+------------+-------------+-------------+----------------+
| l_orderkey | revenue     | o_orderdate | o_shippriority |
+------------+-------------+-------------+----------------+
|   21679558 | 451192.3341 | 1995-01-17  |              0 |
|   57978848 | 450250.4648 | 1995-02-19  |              0 |
|   24295076 | 437186.7777 | 1995-01-05  |              0 |
|   23679299 | 428116.4351 | 1995-02-28  |              0 |
|     492164 | 423270.2092 | 1995-02-19  |              0 |
|   35312039 | 422403.5320 | 1995-03-05  |              0 |
|     820962 | 418407.3101 | 1995-02-11  |              0 |
|   26731940 | 417950.7043 | 1995-02-27  |              0 |
|   36065633 | 417908.8665 | 1995-02-19  |              0 |
|   51262022 | 413274.3434 | 1995-02-11  |              0 |
+------------+-------------+-------------+----------------+
10 rows in set (24.19 sec)

+-----------------+-------------+
| o_orderpriority | order_count |
+-----------------+-------------+
| 1-URGENT        |      105597 |
| 2-HIGH          |      105754 |
| 3-MEDIUM        |      105026 |
| 4-NOT SPECIFIED |      104819 |
| 5-LOW           |      105309 |
+-----------------+-------------+
5 rows in set (12.75 sec)

+------------+----------------+
| n_name     | revenue        |
+------------+----------------+
| MOROCCO    | 540038731.8977 |
| KENYA      | 536052927.7305 |
| ETHIOPIA   | 520384942.7652 |
| MOZAMBIQUE | 520109603.6710 |
| ALGERIA    | 519498315.2213 |
+------------+----------------+
5 rows in set (18.69 sec)

+-----------------+
| revenue         |
+-----------------+
| 2014944457.3560 |
+-----------------+
1 row in set (33.15 sec)

+----------------+----------------+--------+----------------+
| supp_nation    | cust_nation    | l_year | revenue        |
+----------------+----------------+--------+----------------+
| ROMANIA        | UNITED KINGDOM |   1995 | 529821664.1735 |
| ROMANIA        | UNITED KINGDOM |   1996 | 541319833.0274 |
| UNITED KINGDOM | ROMANIA        |   1995 | 528819804.2166 |
| UNITED KINGDOM | ROMANIA        |   1996 | 525485490.0643 |
+----------------+----------------+--------+----------------+
4 rows in set (16.27 sec)

+--------+------------+
| o_year | mkt_share  |
+--------+------------+
|   1995 | 0.03780949 |
|   1996 | 0.03851161 |
+--------+------------+
2 rows in set (26.66 sec)

使用道具 举报

回复
论坛徽章:
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
29#
 楼主| 发表于 2011-6-5 10:30 | 只看该作者
+-----------+--------+----------------+
| nation    | o_year | sum_profit     |
+-----------+--------+----------------+
| ALGERIA   |   1998 | 352822350.0693 |
| ALGERIA   |   1997 | 596671435.2478 |
| ALGERIA   |   1996 | 602177243.0192 |
| ALGERIA   |   1995 | 606831210.8801 |
| ALGERIA   |   1994 | 595415097.2158 |
| ALGERIA   |   1993 | 601347225.0045 |
| ALGERIA   |   1992 | 594128993.7166 |
| ARGENTINA |   1998 | 366005512.6697 |
| ARGENTINA |   1997 | 614815785.9445 |
| ARGENTINA |   1996 | 621181784.9130 |
+-----------+--------+----------------+
10 rows in set (4 min 18.61 sec)

+-----------+--------------------+-------------+-----------+----------------+------------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+
| c_custkey | c_name             | revenue     | c_acctbal | n_name         | c_address                                | c_phone         | c_comment                                                                                               |
+-----------+--------------------+-------------+-----------+----------------+------------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+
|    859087 | Customer#000859087 | 795591.1319 |   4009.94 | PERU           | i VYSwydv M5ss0b                         | 27-458-775-5124 | the enticingly regular packages. fluffily                                                               |
|    740428 | Customer#000740428 | 774058.5652 |   8832.45 | UNITED KINGDOM | f6GR6VnLK,yXj8mxGUIwXBh6R                | 33-486-888-6888 | ual, even dependencies are. s                                                                           |
|   1121018 | Customer#001121018 | 771017.7419 |    440.07 | FRANCE         | kymXkSpb2QJwM0fyG5akNjEpABQ6KMVL         | 16-979-738-3029 |  gifts. blithely final pinto beans above the ironic requests cajole after the spe                       |
|    940558 | Customer#000940558 | 757257.8295 |   9296.89 | IRAQ           | rbUTQJaBKK                               | 21-412-697-1127 | l accounts use. quickly ironic platelets according to the bold courts use fluffily along                |
|    626548 | Customer#000626548 | 741637.4629 |   8816.29 | CANADA         | wC,cqFOqmayHMp5wsz9                      | 13-108-148-1920 | ites haggle carefully quickly final packages. slyly unusual instructions are. furiously pending depos   |
|    176566 | Customer#000176566 | 740436.4792 |   6653.77 | IRAQ           | P6cScNofcMOgN                            | 21-481-935-8112 | nts. even platelets about the slyly pending theodoli                                                    |
|    398209 | Customer#000398209 | 737423.6546 |   8078.60 | BRAZIL         | Np9BZBmhKjnV2RyVJDRu3VN2                 | 12-677-416-7086 | s requests. carefully idle pinto beans impress. regular, ironic deposits cajole final deposits. furious |
|    105427 | Customer#000105427 | 733099.2779 |   1913.89 | FRANCE         | VNa1DaHYUaS5j                            | 16-588-422-6089 | e blithely instructions. ironic tithes sleep furiously through the fluf                                 |
|   1427804 | Customer#001427804 | 726550.3773 |   5641.37 | ETHIOPIA       | w24QdAVFSER                              | 15-973-207-5120 |  boost slyly alongside of the daring deposits. dependencies us                                          |
|    365584 | Customer#000365584 | 721747.2564 |   7085.64 | CANADA         | LsxxTCJ2nGrptdL                          | 13-881-145-1128 | s packages. slyly regular patterns boost bold, unusual accounts.                                        |
|   1391057 | Customer#001391057 | 707403.3930 |   -956.13 | ETHIOPIA       | wU4WfTvm3zsH99                           | 15-744-116-1290 | tes use waters. fluffily special ideas along the regular, ironic                                        |
|   1081033 | Customer#001081033 | 697514.1760 |   8912.66 | VIETNAM        | kc17y n5axGKI7vtZZYyPN, 3KURHDzNL5snT    | 31-738-534-2032 | he fluffily regular pinto beans. deposits detect thinly.                                                |
|    744874 | Customer#000744874 | 696698.6251 |    269.30 | CHINA          | J6yHXhjiLifQYl6S, wNzAWj9QmY4            | 28-380-324-8315 | ld dugouts nag furiously after the always unusual theodolites. quickly unusual                          |
|   1177250 | Customer#001177250 | 695476.5153 |   -622.72 | ROMANIA        | qGZWM0sT8ZUXZ                            | 29-104-754-1207 | dolites sleep quickly ironic packages. silent packages haggle carefully                                 |
|    901693 | Customer#000901693 | 694203.9166 |   4822.73 | VIETNAM        | o0EVo9buBfc5ZY,gi4VFvXjWR,qJNhjPHXvx mtY | 31-623-126-9286 | ages sleep above the slyly regular requests. carefully even theodolites after the special, bold accoun  |
|   1478164 | Customer#001478164 | 692618.5550 |   9128.79 | IRAN           | 2vy4nYJ,WD y0uz7uMvtcRmT2D8HSt4S9CbF     | 20-455-516-1410 | usly furiously regular pinto beans. blithely i                                                          |
|    236758 | Customer#000236758 | 691176.2952 |   8416.76 | ROMANIA        | z eZsbos p u                             | 29-844-815-1064 | eep furiously: pending deposits boost carefully even, final excuses. even, pendi                        |
|    553184 | Customer#000553184 | 690088.7148 |   5826.55 | SAUDI ARABIA   | ir9Q2bjnZilhFoS8gH4I3                    | 30-599-126-7708 | lyly thin forges cajole slyly? regular deposits according to the special, express notornis cajole       |
|   1459033 | Customer#001459033 | 683803.2768 |   9049.44 | INDONESIA      | ZtmMQwHl3OEEmRMFIeRTDuQhEuDVNaQIl31a     | 19-680-834-9042 | he slyly bold accounts. carefully ironic foxes cajole bravely                                           |
|     57454 | Customer#000057454 | 677202.9870 |   9740.34 | ETHIOPIA       | 3UuMxx1kC9yhoWNVszz7zfVN9817toLaS        | 15-589-139-5007 | e fluffily. express foxes among the slyly final in                                                      |
+-----------+--------------------+-------------+-----------+----------------+------------------------------------------+-----------------+---------------------------------------------------------------------------------------------------------+
20 rows in set (1 min 39.80 sec)

Empty set (4.24 sec)

+------------+-----------------+----------------+
| l_shipmode | high_line_count | low_line_count |
+------------+-----------------+----------------+
| FOB        |           62738 |          93486 |
| MAIL       |           62206 |          93979 |
+------------+-----------------+----------------+
2 rows in set (1 min 24.41 sec)

+---------+----------+
| c_count | custdist |
+---------+----------+
|       0 |   500023 |
|      10 |    65974 |
|       9 |    65196 |
|      11 |    62247 |
|       8 |    58373 |
|      12 |    55809 |
|      13 |    49853 |
|       7 |    46762 |
|      19 |    46735 |
|      18 |    46216 |
+---------+----------+
10 rows in set (1 min 6.37 sec)

+---------------+
| promo_revenue |
+---------------+
| 16.6088216759 |
+---------------+
1 row in set (38.50 sec)

+-----------+--------------------+---------------------+-----------------+---------------+
| s_suppkey | s_name             | s_address           | s_phone         | total_revenue |
+-----------+--------------------+---------------------+-----------------+---------------+
|     83966 | Supplier#000083966 | 0ITp9HCIUHEHgWCjeTt | 24-897-113-5492 |  2147201.6871 |
+-----------+--------------------+---------------------+-----------------+---------------+
1 row in set (1 min 23.74 sec)

+----------+---------------------------+--------+--------------+
| p_brand  | p_type                    | p_size | supplier_cnt |
+----------+---------------------------+--------+--------------+
| Brand#33 | STANDARD BURNISHED COPPER |     42 |          116 |
| Brand#51 | PROMO PLATED STEEL        |     28 |          104 |
| Brand#11 | ECONOMY ANODIZED COPPER   |     28 |          100 |
| Brand#42 | PROMO BURNISHED NICKEL    |     27 |          100 |
| Brand#11 | ECONOMY POLISHED COPPER   |     41 |           99 |
| Brand#51 | ECONOMY PLATED NICKEL     |     10 |           96 |
| Brand#14 | ECONOMY PLATED COPPER     |     42 |           95 |
| Brand#43 | MEDIUM PLATED NICKEL      |     28 |           95 |
| Brand#11 | LARGE POLISHED COPPER     |     10 |           92 |
| Brand#15 | ECONOMY BURNISHED NICKEL  |     28 |           92 |
+----------+---------------------------+--------+--------------+
10 rows in set (11.15 sec)

mysql>

使用道具 举报

回复
论坛徽章:
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
30#
 楼主| 发表于 2011-6-5 17:11 | 只看该作者
执行计划多长时间,执行就多长。。。难道没有统计信息,现场收集的

mysql> explain -- 17c
    -> select
    ->  sum(l_extendedprice) / 7.0 as avg_yearly
    -> from (select l_extendedprice, l_partkey ,l_quantity
    ->  from
    ->   lineitem,
    ->   part
    ->  where
    ->  p_partkey = l_partkey
    ->  and p_brand = 'Brand#23'
    ->  and p_container = 'MED CAN'
    ->  )b
    ->  ,(select l_partkey,0.2 * avg(l_quantity) p2avg_l_quantity
    ->  from
    ->  (select l_partkey,l_quantity from
    ->   lineitem
    ->  where
    ->   l_partkey in (select p_partkey from part where p_brand = 'Brand#23'and p_container = 'MED CAN')
    ->  )a
    ->  group by l_partkey
    ->  )c
    -> where b.l_partkey=c.l_partkey and b.l_quantity <p2avg_l_quantity
    -> ;
+----+--------------------+------------+-----------------+---------------+---------+---------+-------------------------+----------+---------------------------------+
| id | select_type        | table      | type            | possible_keys | key     | key_len | ref                     | rows     | Extra                           |
+----+--------------------+------------+-----------------+---------------+---------+---------+-------------------------+----------+---------------------------------+
|  1 | PRIMARY            | <derived3> | ALL             | NULL          | NULL    | NULL    | NULL                    |     2031 |                                 |
|  1 | PRIMARY            | <derived2> | ALL             | NULL          | NULL    | NULL    | NULL                    |    61007 | Using where; Using join buffer  |
|  3 | DERIVED            | <derived4> | ALL             | NULL          | NULL    | NULL    | NULL                    |    61007 | Using temporary; Using filesort |
|  4 | DERIVED            | lineitem   | ALL             | NULL          | NULL    | NULL    | NULL                    | 60070444 | Using where                     |
|  5 | DEPENDENT SUBQUERY | part       | unique_subquery | PRIMARY       | PRIMARY | 4       | func                    |        1 | Using where                     |
|  2 | DERIVED            | lineitem   | ALL             | NULL          | NULL    | NULL    | NULL                    | 60070444 |                                 |
|  2 | DERIVED            | part       | eq_ref          | PRIMARY       | PRIMARY | 4       | tpch.lineitem.l_partkey |        1 | Using where                     |
+----+--------------------+------------+-----------------+---------------+---------+---------+-------------------------+----------+---------------------------------+
7 rows in set (5 min 3.29 sec)

mysql> -- 17c
mysql> select
    ->  sum(l_extendedprice) / 7.0 as avg_yearly
    -> from (select l_extendedprice, l_partkey ,l_quantity
    ->  from
    ->  lineitem,
    ->  part
    ->  where
    ->  p_partkey = l_partkey
    ->  and p_brand = 'Brand#23'
    ->  and p_container = 'MED CAN'
    ->  )b
    ->  ,(select l_partkey,0.2 * avg(l_quantity) p2avg_l_quantity
    ->  from
    ->  (select l_partkey,l_quantity from
    ->  lineitem
    ->  where
    ->  l_partkey in (select p_partkey from part where p_brand = 'Brand#23'and p_container = 'MED CAN')
    ->  )a
    ->  group by l_partkey
    ->  )c
    -> where b.l_partkey=c.l_partkey and b.l_quantity <p2avg_l_quantity
    -> ;
+----------------+
| avg_yearly     |
+----------------+
| 3188455.648571 |
+----------------+
1 row in set (5 min 2.25 sec)

mysql>

使用道具 举报

回复

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

本版积分规则 发表回复

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