我们看到,导入总用时5分15秒,其中最大的lineitem表用了大约4分钟。导入完成后,用du命令查看数据文件占用的空间大小,并和用于导入的文本文件作比较。
[ingres@redflag11012602 ~]$ cd /user1/app/vw15/
[ingres@redflag11012602 vw15]$ ls
customer.tbl ingres nation.tblpartsupp.tblregion.tbl
tpc-h_orig21_ingres.sql
dss_ingres.ddllineitem.tblorders.tblpart.tbl supplier.tbl
[ingres@redflag11012602 vw15]$ cd ingres
[ingres@redflag11012602 ingres]$ ls
binckpdatademodmpfilesjnlliblogsigutilityvdbaversion.relwork
[ingres@redflag11012602 ingres]$ cd data
[ingres@redflag11012602 data]$ ls
defaultvectorwise
[ingres@redflag11012602 data]$ du -s vectorwise
5701788 vectorwise
[ingres@redflag11012602 data]$ cd vectorwise
[ingres@redflag11012602 vectorwise]$ ls
tpchvectorwise.conf
[ingres@redflag11012602 vectorwise]$ ls tpch
authpassCBM
[ingres@redflag11012602 vectorwise]$ cd tpch/CBM
[ingres@redflag11012602 CBM]$ ls
defaultlockLOG
[ingres@redflag11012602 CBM]$ ls default
0
[ingres@redflag11012602 CBM]$ cd default
[ingres@redflag11012602 default]$ ll
总计 5699800
-rw------- 1 ingres ingres 5899419648 04-03 19:35 0
[ingres@redflag11012602 default]$ du -s /user1/app/vw15/*tbl
240816/user1/app/vw15/customer.tbl
7659556 /user1/app/vw15/lineitem.tbl
4 /user1/app/vw15/nation.tbl
1724536 /user1/app/vw15/orders.tbl
1185592 /user1/app/vw15/partsupp.tbl
240552/user1/app/vw15/part.tbl
4 /user1/app/vw15/region.tbl
13964 /user1/app/vw15/supplier.tbl
[ingres@redflag11012602 default]$
[ingres@redflag11012602 vw15]$ ls
customer.tbl ingres nation.tblpartsupp.tblregion.tbl
tpc-h_orig21_ingres.sql
dss_ingres.ddllineitem.tblorders.tblpart.tbl supplier.tbl
[ingres@redflag11012602 vw15]$ cd ingres
[ingres@redflag11012602 ingres]$ ls
binckpdatademodmpfilesjnlliblogsigutilityvdbaversion.relwork
[ingres@redflag11012602 ingres]$ cd data
[ingres@redflag11012602 data]$ ls
defaultvectorwise
[ingres@redflag11012602 data]$ du -s vectorwise
5701788 vectorwise
[ingres@redflag11012602 data]$ cd vectorwise
[ingres@redflag11012602 vectorwise]$ ls
tpchvectorwise.conf
[ingres@redflag11012602 vectorwise]$ ls tpch
authpassCBM
[ingres@redflag11012602 vectorwise]$ cd tpch/CBM
[ingres@redflag11012602 CBM]$ ls
defaultlockLOG
[ingres@redflag11012602 CBM]$ ls default
0
[ingres@redflag11012602 CBM]$ cd default
[ingres@redflag11012602 default]$ ll
总计 5699800
-rw------- 1 ingres ingres 5899419648 04-03 19:35 0
[ingres@redflag11012602 default]$ du -s /user1/app/vw15/*tbl
240816/user1/app/vw15/customer.tbl
7659556 /user1/app/vw15/lineitem.tbl
4 /user1/app/vw15/nation.tbl
1724536 /user1/app/vw15/orders.tbl
1185592 /user1/app/vw15/partsupp.tbl
240552/user1/app/vw15/part.tbl
4 /user1/app/vw15/region.tbl
13964 /user1/app/vw15/supplier.tbl
[ingres@redflag11012602 default]$
数据文件0的大小是5701788KB,而8个tbl文件占用的空间大小是11065024KB,导入后数据大约是原始文件的52%,压缩了近一半。压缩率虽不算高,但我们一直强调,现今存储价格日益低廉,压缩不是目的,而是提高查询效率的手段,因此,即使没有压缩,只要查询高效,同样是“好数据库”。下面,我们来测试COPY命令的导入,由于VectorWise没有truncate table命令,因此先删除lineitem表,并用建表脚本重建它。
* drop table lineitem\g
Executing . . .
continue
* commit\g
Executing . . .
continue
* \q
VectorWise Version VW 1.5.0 (a64.lnx/141)NPTL logout
Mon Apr4 19:25:57 2011
[ingres@redflag11012602 ~]$ sql tpch
INGRES TERMINAL MONITOR Copyright 2010 Ingres Corporation
VectorWise Linux Version VW 1.5.0 (a64.lnx/141)NPTL login
Mon Apr4 19:26:02 2011
Enter \g to execute commands, "help help\g" for help, \q to quit
continue
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Executing . . .
E_US07DA Duplicate object name 'nation'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'region'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'part'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'supplier'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'partsupp'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'customer'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'orders'.
(Mon Apr4 19:26:02 2011)
continue
*
Your SQL statement(s) have been committed.
VectorWise Version VW 1.5.0 (a64.lnx/141)NPTL logout
Mon Apr4 19:26:02 2011
[ingres@redflag11012602 ~]$ sql tpch
INGRES TERMINAL MONITOR Copyright 2010 Ingres Corporation
VectorWise Linux Version VW 1.5.0 (a64.lnx/141)NPTL login
Mon Apr4 19:26:16 2011
Enter \g to execute commands, "help help\g" for help, \q to quit
continue
* select count(*) from lineitem;
* \g
Executing . . .
+----------------------+
|col1 |
+----------------------+
| 0|
+----------------------+
(1 row)
continue
* COPY TABLE lineitem (
*l_orderkey = 'c0|',
*l_partkey = 'c0|',
*l_suppkey = 'c0|',
*l_linenumber = 'c0|',
*l_quantity = 'c0|',
*l_extendedprice = 'c0|',
*l_discount = 'c0|',
*l_tax = 'c0|',
*l_returnflag = 'c0|',
*l_linestatus = 'c0|',
*l_shipdate = 'c0|',
*l_commitdate = 'c0|',
*l_receiptdate = 'c0|',
*l_shipinstruct = 'c0|',
*l_shipmode = 'c0|',
*l_comment = 'c0nl'
* ) FROM '/user1/app/vw15/lineitem.tbl' \t\g\t
Mon Apr4 19:28:51 2011
Executing . . .
(59986052 rows)
Mon Apr4 19:42:33 2011
* commit\g
Executing . . .
continue
[ingres@redflag11012602 ingres]$ du -s data
5763656 data
[ingres@redflag11012602 ingres]$ cd
Executing . . .
continue
* commit\g
Executing . . .
continue
* \q
VectorWise Version VW 1.5.0 (a64.lnx/141)NPTL logout
Mon Apr4 19:25:57 2011
[ingres@redflag11012602 ~]$ sql tpch
INGRES TERMINAL MONITOR Copyright 2010 Ingres Corporation
VectorWise Linux Version VW 1.5.0 (a64.lnx/141)NPTL login
Mon Apr4 19:26:02 2011
Enter \g to execute commands, "help help\g" for help, \q to quit
continue
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Executing . . .
E_US07DA Duplicate object name 'nation'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'region'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'part'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'supplier'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'partsupp'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'customer'.
(Mon Apr4 19:26:02 2011)
E_US07DA Duplicate object name 'orders'.
(Mon Apr4 19:26:02 2011)
continue
*
Your SQL statement(s) have been committed.
VectorWise Version VW 1.5.0 (a64.lnx/141)NPTL logout
Mon Apr4 19:26:02 2011
[ingres@redflag11012602 ~]$ sql tpch
INGRES TERMINAL MONITOR Copyright 2010 Ingres Corporation
VectorWise Linux Version VW 1.5.0 (a64.lnx/141)NPTL login
Mon Apr4 19:26:16 2011
Enter \g to execute commands, "help help\g" for help, \q to quit
continue
* select count(*) from lineitem;
* \g
Executing . . .
+----------------------+
|col1 |
+----------------------+
| 0|
+----------------------+
(1 row)
continue
* COPY TABLE lineitem (
*l_orderkey = 'c0|',
*l_partkey = 'c0|',
*l_suppkey = 'c0|',
*l_linenumber = 'c0|',
*l_quantity = 'c0|',
*l_extendedprice = 'c0|',
*l_discount = 'c0|',
*l_tax = 'c0|',
*l_returnflag = 'c0|',
*l_linestatus = 'c0|',
*l_shipdate = 'c0|',
*l_commitdate = 'c0|',
*l_receiptdate = 'c0|',
*l_shipinstruct = 'c0|',
*l_shipmode = 'c0|',
*l_comment = 'c0nl'
* ) FROM '/user1/app/vw15/lineitem.tbl' \t\g\t
Mon Apr4 19:28:51 2011
Executing . . .
(59986052 rows)
Mon Apr4 19:42:33 2011
* commit\g
Executing . . .
continue
[ingres@redflag11012602 ingres]$ du -s data
5763656 data
[ingres@redflag11012602 ingres]$ cd
导入同样的lineitem.tbl文件,copy命令用了13分42秒,比iivwfastload多用了约3倍的时间,但是copy命令也有自己的优势,它可以单独为每一列设定不同的列分隔符,并可以用不存在的列名跳过文本文件中不需要的列,比iivwfastload具有更大的灵活性。用copy 命令导入的数据文件比iivwfastload略大,我们在下文再比较二者的查询性能。