创建与维护Oracle分区表和本地索引
2008-08-26 12:44:08 来源:WEB开发网 SQL>COLsegment_namefora20
SQL>COLPARTITION_NAMEfora20
SQL>SELECTsegment_name,partition_name,tablespace_name
2FROMdba_segments
3WHEREsegment_name='DBOBJS_IDX';
SEGMENT_NAMEPARTITION_NAMETABLESPACE_NAME
----------------------------------------------------------------------
DBOBJS_IDXDBOBJS_06USERS
DBOBJS_IDXDBOBJS_07USERS
SQL>insertintodbobjs
2selectobject_id,object_name,created
3fromdba_objectswherecreated
6227rowscreated.
SQL>commit;
Commitcomplete.
SQL>selectcount(*)fromdbobjspartition(DBOBJS_06);
COUNT(*)
----------
6154
SQL>selectcount(*)fromdbobjspartition(dbobjs_07);
COUNT(*)
----------
73
我们可以通过查询来对比一下分区表和非分区表的查询性能差异:
SQL>setautotraceon
SQL>selectcount(*)fromdbobjswherecreated<to_date('01/01/2008','dd/mm/yyyy');
COUNT(*)
----------
6227
ExecutionPlan
----------------------------------------------------------
0SELECTSTATEMENTptimizer=CHOOSE(Cost=1Card=1Bytes=9)
10SORT(AGGREGATE)
21PARTITIONRANGE(ALL)
32INDEX(RANGESCAN)OF'DBOBJS_IDX'(NON-UNIQUE)(Cost=2Card=8Bytes=72)
Statistics
----------------------------------------------------------
0recursivecalls
0dbblockgets
25consistentgets
0physicalreads
0redosize
380bytessentviaSQL*Nettoclient
503bytesreceivedviaSQL*Netfromclient
2SQL*Netroundtripsto/fromclient
0sorts(memory)
0sorts(disk)
1rowsprocessed
SQL>selectcount(*)fromdbobjswherecreated<to_date('01/01/2007','dd/mm/yyyy');
COUNT(*)
----------
6154
ExecutionPlan
----------------------------------------------------------
0SELECTSTATEMENTptimizer=CHOOSE(Cost=1Card=1Bytes=9)
10SORT(AGGREGATE)
21INDEX(RANGESCAN)OF'DBOBJS_IDX'(NON-UNIQUE)(Cost=2Card=4Bytes=36)
Statistics
----------------------------------------------------------
0recursivecalls
0dbblockgets
24consistentgets
0physicalreads
0redosize
380bytessentviaSQL*Nettoclient
503bytesreceivedviaSQL*Netfromclient
2SQL*Netroundtripsto/fromclient
0sorts(memory)
0sorts(disk)
1rowsprocessed
SQL>selectcount(distinct(object_name))fromdbobjswherecreated<to_date('01/01/2007','dd/mm/yyyy');
COUNT(DISTINCT(OBJECT_NAME))
----------------------------
4753
ExecutionPlan
----------------------------------------------------------
0SELECTSTATEMENTptimizer=CHOOSE(Cost=1Card=1Bytes=75)
10SORT(GROUPBY)
21TABLEACCESS(BYLOCALINDEXROWID)OF'DBOBJS'(Cost=1Card=4Bytes=300)
32INDEX(RANGESCAN)OF'DBOBJS_IDX'(NON-UNIQUE)(Cost=2Card=1)
Statistics
----------------------------------------------------------
0recursivecalls
0dbblockgets
101consistentgets
0physicalreads
0redosize
400bytessentviaSQL*Nettoclient
503bytesreceivedviaSQL*Netfromclient
2SQL*Netroundtripsto/fromclient
1sorts(memory)
0sorts(disk)
1rowsprocessed
对于非分区表的测试:
- ››oracle 中 UPDATE nowait 的使用方法
- ››Oracle ORA-12560解决方法
- ››Oracle 10g RAC 常用维护命令
- ››Oracle如何在ASM中定位文件的分布
- ››Oracle的DBMS_RANDOM.STRING 的用法
- ››oracle 外部表导入时间日期类型数据,多字段导入
- ››Oracle中查找重复记录
- ››oracle修改用户登录密码
- ››Oracle创建删除用户、角色、表空间、导入导出等命...
- ››Oracle中登陆时报ORA-28000: the account is lock...
- ››Oracle数据库在配置文件中更改最大连接数
- ››Oracle中在pl/sql developer修改表的两种方式
赞助商链接