Oracle数据获取的实际方式演示

数据库 Oracle
我们今天主要和大家描述的是Oracle数据获取的实际方式的测试的实际操作步骤,以下就是文章的具体的相关内容介绍。

以下的文章主要主要是对Oracle数据获取的实际方式的测试,我们首先是通过建立典型的实验环境,来对Oracle数据获取的实际操作来进行详细的说明,以下就是文章的具体内容描述,望你浏览之后会有所收获。

首先建立实验环境 

  1. create table test as select * from dba_objects where 0=1;  
  2. create index ind_test_id on test(object_id);  
  3. insert into test select * from dba_objects  
  4. where object_id is not null and object_id>10000 order by object_id desc;  
  5. analyze table test compute statistics for table for all columns for all indexes;  
  6. Table Access Full  
  7. SQL> set autotrace trace;  
  8. SQL> select object_id from test;  
  9. set autotrace trace;  
  10. select object_id from test;  
  11. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |  
  12. 1 | TABLE ACCESS FULL| TEST | 58650 | 229K | 239 (1)| 00:00:03 |  

 注意这是因为object_id列默认是可以为null的,如果修改成not null那么Oracle数据获取方式会变成什么方式?

  1. Index Fast Full Scan  
  2. alter table test modify(object_id not null);  
  3. select object_id from test;  
  4. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |  
  5. 1 | INDEX FAST FULL SCAN| IND_TEST_ID | 58650 | 229K| 66 (0)| 00:00:01 |  
  6. Index Full Scan  
  7. select/*+ index(test ind_TEST_ID)*/ object_id from test;  
  8. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |  
  9. 1 | INDEX FULL SCAN| IND_TEST_ID | 58650 | 229K| 240 (1)| 00:00:03 |  
  10. Index Range Scan  
  11. select/*+ index(test ind_TEST_ID)*/ object_id from test where object_id < 68926;  
  12. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |  
  13. 1 | INDEX RANGE SCAN| IND_TEST_ID | 57903 | 226K| 237 (1)| 00:00:03  
  14. SQL> select object_id from test where rownum<11INDEX FAST FULL SCAN  
  15. OBJECT_ID  
  16. 68917  
  17. 68918  
  18. 68919  
  19. 68920  
  20. 68921  
  21. 68922  
  22. 68923  
  23. 68924  
  24. 68925  
  25. 68926  

 已选择10行。

  1. SQL> select/*+ index(test ind_TEST_ID)*/ object_id from test where rownum<11; INDEX FULL SCAN  
  2. OBJECT_ID  
  3. 10001  
  4. 10002  
  5. 10003  
  6. 10004  
  7. 10005  
  8. 10006  
  9. 10007  
  10. 10008  
  11. 10009  
  12. 10010  

 已选择10行。 

  1. select * from test where rownum < 2;  
  2. ....... 69554 .......  

其他的不关注只关注OBJECT_ID列 。以上的相关内容就是对@@@@@@@的介绍,望你能有所收获。

 【编辑推荐】

  1. 实现Oracle传输表空间的功能“窍门”
  2. Oracle rownum的实际用法的汇总
  3. 对Oracle 10g中hints调整机制解析
  4. Oracle数据库安全性中的问题有哪些?
  5. Oracle数据集成的解决方案详解
责任编辑:佚名 来源: 互联网
相关推荐

2010-04-19 09:26:04

Oracle数据库

2010-04-09 13:35:35

Oracle启动

2010-04-26 17:06:05

Oracle数据

2010-06-12 09:53:19

2010-06-07 16:22:55

MySQL数据库

2010-04-16 13:59:40

Oracle数据

2010-04-28 15:04:37

Oracle数据

2010-04-30 17:33:27

Oracle数据集成

2010-04-14 09:33:58

Oracle Spat

2010-04-29 10:41:55

2010-04-26 09:41:48

Oracle sqlp

2010-03-30 16:33:55

Oracle数据类型

2010-05-10 10:19:28

Oracle实战RMA

2010-04-21 11:27:55

Oracle数据库

2010-05-31 14:59:36

PHP + MySQL

2010-05-18 17:24:44

MySQL修改表字段

2010-04-20 08:53:42

Oracle左连接

2010-04-01 13:09:12

Oracle中join

2010-04-13 12:23:34

Oracle数据库

2010-04-28 10:13:37

Oracle删除重复数
点赞
收藏

51CTO技术栈公众号