[20130812]12c Partial Indexes For Partitioned Tables Part II.txt

[20130812]12c Partial Indexes For Partitioned Tables Part II.txt

参考链接:
http://richardfoote.wordpress.com/2013/07/12/12c-partial-indexes-for-partitioned-tables-part-ii-vanishing-act/

更多的是重复作者的测试,加深理解:

1.测试环境:

SQL> @ver
BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production              0

2.测试建立:

SQL> drop table PINK_FLOYD purge ;
Table dropped.

SQL> create table pink_floyd (id number, status varchar2(6), name varchar2(30))
indexing off
partition by range (id)
(partition pf1 values less than (1000001),
partition pf2 values less than (2000001) indexing off,
partition pf3 values less than (maxvalue) indexing on);
Table created.

SQL> insert into pink_floyd
select rownum, 'CLOSED', 'DAVID BOWIE' from
(select 1 from dual connect by level (select 1 from dual connect by level
3000000 rows created.

SQL> create index pink_floyd_status_i on pink_floyd(status) local indexing partial;
Index created.
SQL> select index_name, partition_name, num_rows, status, leaf_blocks from dba_ind_partitions where index_name = 'PINK_FLOYD_STATUS_I';
INDEX_NAME           PARTITION_NAME         NUM_ROWS STATUS   LEAF_BLOCKS
-------------------- -------------------- ---------- -------- -----------
PINK_FLOYD_STATUS_I  PF1                           0 UNUSABLE           0
PINK_FLOYD_STATUS_I  PF2                           0 UNUSABLE           0
PINK_FLOYD_STATUS_I  PF3                     1000000 USABLE          2507

SQL> create unique index pink_floyd_id_i on pink_floyd(id) indexing partial;
create unique index pink_floyd_id_i on pink_floyd(id) indexing partial
                                       *
ERROR at line 1:
ORA-14226: unique index may not be PARTIAL
--可以发现唯一键值不能使用indexing partial参数。

SQL> alter table pink_floyd add constraint pink_floyd_pk primary key(id)
using index (create index pink_floyd_id_i on pink_floyd(id) indexing partial);
*
ERROR at line 1:
ORA-14196: Specified index cannot be used to enforce the constraint.

SQL> alter table pink_floyd add constraint pink_floyd_pk primary key(id) using index
(create index pink_floyd_id_i on pink_floyd(id) indexing partial);
*
ERROR at line 1:
ORA-14196: Specified index cannot be used to enforce the constraint.

SQL> create index pink_floyd_id_i on pink_floyd(id) indexing partial;
Index created.

SQL> alter table pink_floyd add primary key(id);
alter table pink_floyd add primary key(id)
*
ERROR at line 1:
ORA-01408: such column list already indexed

--部分索引对于PK,unique无效。

http://richardfoote.wordpress.com/2013/07/12/12c-partial-indexes-for-partitioned-tables-part-ii-vanishing-act/

    It clearly doesn't make sense to create a Partial Unique Index or on a Non-Unique Index policing a PK or Unique Key
constraint as it would be impossible to use such an index to guarantee the required unique property. With missing index
entries associated with non-indexed partitions, how can Oracle determine whether a value from new row already exists or
not ? It can't and hence Oracle doesn't permit the creation of such a Partial Index.

    Partial Indexes can potentially be extremely useful in reducing unnecessary storage requirements, reducing index
maintenance overheads and in improving performance by reducing index block accesses.

时间: 2024-07-29 04:56:26

[20130812]12c Partial Indexes For Partitioned Tables Part II.txt的相关文章

[20130812]12c Partial Indexes For Partitioned Tables Part I.txt

[20130812]12c Partial Indexes For Partitioned Tables Part I.txt 参考链接:http://richardfoote.wordpress.com/2013/07/08/12c-partial-indexes-for-partitioned-tables-part-i-ignoreland/ 更多的是重复作者的测试,加深理解: 1.测试环境: SQL> @ver BANNER                                

ORACLE 12C Partial Global/Local Indexes for Partitioned Tables

以前我有个想法,我只想对其中的某个或者某几个分区上创建索引,其他分区不想创建,在12C之前的版本,无论是Local还是Global index,都不能实现该需求,但是从ORACLE 12C开始引进了Partial Global/Local Indexes for Partitioned Tables,解决了该问题,可以在指定的分区上创建本地索引或者全局索引,主要语法是在表或者分区,子分区级别设置[INDEXING { ON | OFF }]创建测试表  代码如下 复制代码 CDB_PDB@CHF

[20130815]12c Asynchronous Global Index Maintenance Part II.txt

[20130815]12c Asynchronous Global Index Maintenance Part II.txt 参考链接:http://richardfoote.wordpress.com/2013/08/06/12c-asynchronous-global-index-maintenance-part-ii-the-space-between/ 更多的是重复作者的测试,加深理解: 1.测试环境: SQL> @ver BANNER                         

[20131019]12c Global Temporary table 统计信息的收集.txt

[20131019]12c Global Temporary table 统计信息的收集.txt 摘要:twp-optimizer-with-oracledb-12c-1963236.pdf Optimizer with Oracle Database 12c Session level statistics on Global Temporary Tables P22 Global temporary tables are often used to store intermediate re

[20141116]12c下增加字段与缺省值.txt

[20141116]12c下增加字段与缺省值.txt --前一段时间写了一篇表增加字段与缺省值的blog. --链接如下: http://blog.itpub.net/267265/viewspace-1257035/ --12G 增加字段带缺省值,可以很快完成,不需要update表.实际上是增加一个隐含字段,通过位与的方式确定取值方式. 当时的总结如下: --增加字段带缺省值,在12c下很快完成,不需修改表,但是以后的插入要多付出2个字节的代价(不会增加9个字段带缺省值的吧^_^) --它通过

[20131116]12c的EXTENDED VARCHAR2与隐含参数_scalar_type_lob_storage_threshold.txt

[20131116]12c的EXTENDED VARCHAR2与隐含参数_scalar_type_lob_storage_threshold.txt 参考链接:http://space.itpub.net/267265/viewspace-776806/ google查询了一些资料: 发现:SYS@test01p> @hide _scalar_type_lob_storage_threshold;NAME                                     DESCRIPTI

[20131116]12c的EXTENDED VARCHAR2与_scalar_type_lob_storage_threshold之2.txt

[20131116]12c的EXTENDED VARCHAR2与_scalar_type_lob_storage_threshold之2.txt 参考链接:http://space.itpub.net/267265/viewspace-776807/ google查询了一些资料: 发现:SYS@test01p> @hide _scalar_type_lob_storage_threshold;NAME                                     DESCRIPTION

[20130924]12c dbms_stats包的一些缺省参数.txt

[20130924]12c dbms_stats包的一些缺省参数.txt 11G下: SQL> @ver BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production SELECT DBMS_STATS.get_param ('AU

MongoDB 部分索引(Partial Indexes)

MongoDB部分索引只为那些在一个集合中,满足指定的筛选条件的文档创建索引.由于部分索引是一个集合文档的一个子集,因此部分索引具有较低的存储需求,并降低了索引创建和维护的性能成本.部分索引通过指定过滤条件来创建,可以为MongoDB支持的所有索引类型使用部分索引. 一.语法描述 创建部分索引语法 db.collection.createIndex(keys, options) options可以使用partialFilterExpression,即部分过滤表达式,其类型为文档类型 过滤表达式通