ITPub博客

首页 > Linux操作系统 > Linux操作系统 > number,binary_float和binary_double

number,binary_float和binary_double

原创 Linux操作系统 作者:qgw521 时间:2008-11-13 22:36:54 0 删除 编辑

SQL> create table fnd (num number,num_float binary_float,num_double binary_float);
 
Table created

SQL> insert /*+append*/ into fnd select rownum,rownum,rownum from dba_objects;
 
50070 rows inserted

SQL> insert into fnd select rownum+11372,rownum+11372,rownum+11372 from dba_objects;
 
50070 rows inserted
 
Executed in 1.063 seconds
 
SQL> insert /*+append*/ into fnd select rownum+23772,rownum+23772,rownum+23772 from dba_objects;
 
50070 rows inserted
 
Executed in 0.781 seconds

SQL> insert into fnd select rownum+11372,rownum+11372,rownum+11372 from dba_objects;
 
50070 rows inserted
 
Executed in 1.063 seconds
 
SQL> insert /*+append*/ into fnd select rownum+23772,rownum+23772,rownum+23772 from dba_objects;
 
50070 rows inserted
 
Executed in 0.781 seconds
 
SQL> commit;
 
Commit complete
 
Executed in 0 seconds

SQL> select count(*) from fnd;
 
  COUNT(*)
----------
    250350
 
Executed in 0.094 seconds

SQL> select sum(num*num) from fnd;
 
SUM(NUM*NUM)
------------
477521168594
 
Executed in 0.125 seconds
 
SQL> select sum(num_float*num_float) from fnd;
 
SUM(NUM_FLOAT*NUM_FLOAT)
------------------------
         477522014000000
 
Executed in 0.078 seconds
 
SQL> select sum(ln(num*num)) from fnd;
 
SUM(LN(NUM*NUM))
----------------
5232311.70321546
 
Executed in 12.812 seconds
 
SQL> select sum(ln(num_float*num_float)) from fnd;
 
SUM(LN(NUM_FLOAT*NUM_FLOAT))
----------------------------
            5232311.70328157
 
Executed in 0.172 seconds
 
SQL> select sum(ln(num_double*num_double)) from fnd;
 
SUM(LN(NUM_DOUBLE*NUM_DOUBLE))
------------------------------
              5232311.70328157
 
Executed in 0.187 seconds

可见一般的运算number,binary_float,binary_double效率差不了多少,如果是复杂点的运算,特别是科学计算类的,binary_float,binary_double的效率就很明显.

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13387766/viewspace-495571/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Oracle锁的总结
请登录后发表评论 登录
全部评论

注册时间:2008-06-06

  • 博文量
    128
  • 访问量
    277991