再对比一下压缩表和非压缩表在读方面的性能:
SQL> alter session set sql_trace=true;
Session altered.
SQL> select count(*) from test_nocompress;
COUNT(*)
----------
64000
SQL> select count(*) from test_compress;
COUNT(*)
----------
64000
查看生成的trace文件
select count(*)
from
test_nocompress
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.01 0.00 0 0 0 0
Fetch 2 0.24 0.23 604 608 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.25 0.24 604 608 0 1
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: SYS
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=608 r=604 w=0 time=238185 us)
64000 TABLE ACCESS FULL TEST_NOCOMPRESS (cr=608 r=604 w=0 time=157204 us)
********************************************************************************
select count(*)
from
test_compress
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.18 0.17 89 94 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.18 0.17 89 94 0 1
可以看出,压缩表在读性能上还是有明显优势
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-506562/ ,如需转载,请注明出处,否则将追究法律责任。