- 论坛徽章:
- 0
|
N周前听公司内一位高人讲课,他说oracle对同样一个源数据的空间的占用会比mysql多20%,一直心存疑虑,很想测试一下他说的
今天因为跟colin做个统计,涉及导入DW数据,所以正好观察了一下。
有一个文本文件大小有168M,共5793517行。
首先上午我将他导入到了oracle中做统计:
oracle的表结构如下:
Name Null? Type
----------------------------------------------------- -------- ------------------------------------
UIN NUMBER(11)
PET_ID NUMBER(20)
THKS NUMBER(11)
存储占用如下:
header_file:50 header_block:15115 bytes:179306496 blocks:21888
不知道什么是header_block,我再sqlldr导入相同量的数据,变化如下:
header_file:50 header_block:15115 bytes:346030080 blocks:42240
我还以为header就占了那么多block,结果是如下意思:
HEADER_FILE NUMBER ID of the file containing the segment header
HEADER_BLOCK NUMBER ID of the block containing the segment header
再看一下mysql:
mysql> desc thanks;
+--------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+------------+------+-----+---------+-------+
| uin | int(11) | YES | | NULL | |
| pet_id | bigint(20) | YES | | NULL | |
| thks | int(11) | YES | | NULL | |
+--------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> desc thanks_isam;
+--------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+------------+------+-----+---------+-------+
| uin | int(11) | YES | | NULL | |
| pet_id | bigint(20) | YES | | NULL | |
| thks | int(11) | YES | | NULL | |
+--------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> show table status like 'thanks%';
+-------------+--------+---------+------------+---------+----------------+-------------+------------------+--------------+-----------+----------------+---------------------+---------------------+------------+----------------+----------+----------------+-------------------------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+-------------+--------+---------+------------+---------+----------------+-------------+------------------+--------------+-----------+----------------+---------------------+---------------------+------------+----------------+----------+----------------+-------------------------+
| thanks | InnoDB | 10 | Compact | 5793789 | 44 | 259817472 | 0 | 0 | 0 | NULL | 2007-12-14 19:00:34 | NULL | NULL | gbk_chinese_ci | NULL | | InnoDB free: 3816448 kB |
| thanks_isam | MyISAM | 10 | Fixed | 5793517 | 17 | 98489789 | 4785074604081151 | 1024 | 0 | NULL | 2007-12-14 19:02:54 | 2007-12-14 19:03:10 | NULL | gbk_chinese_ci | NULL | | |
+-------------+--------+---------+------------+---------+----------------+-------------+------------------+--------------+-----------+----------------+---------------------+---------------------+------------+----------------+----------+----------------+-------------------------+
myisam用了98M,innodb用了259M
今天做完oracle的测试我还又去问了一下高人,他确实高,他对数据的敏感度好高啊:
me 12:00:39
我上次听你讲课,记得你说导入到oracle中的数据会浪费20%的空间,可我今天看了一下168M的文本文件倒进去,也就171M,似乎没什么浪费的
gaoren 18:01:53
me 12:00:39
我上次听你讲课,记得你说导入到oracle中的数据会浪费20%的空间,可我今天看了一下168M的文本文件倒进去,也就171M,似乎没什么浪费的
168M的文本文件,二进制文件可能也就100M。你导进去mysql试试,那个接近二进制文件大小
比如整数,二进制是4字节,文本可就长了
me 19:04:03
你一定说的是myisam了
me 19:04:32
我们这边用的都是innodb engine,倒进去更大,250多M
me 19:05:02
myisam确实小,仅仅98M |
|