在Oracle11gR1中,oracle以不可见索引和虚拟字段的形式引入了一些不错的增强特性。继承前者并发扬光大,oracle12cR2
中引入了不可见字段思想。在之前的版本中为了隐藏重要的数据字段以避免在通用查询中显示,我们往往会创建一个视图来隐藏所需要的信息或应用某些安全条件。在12cR1 中,你可以在表中创建不可见字段,当一个字段为不可见时,这一字段就不会出现在通用查询中,除非在SQL语句或条件中有显示的体积这一字段,或是在表定义中有described,要添加或是修改一个不可见的字段是非常容易的,反之亦然。
对于相同字段的多重索引,在12cR1之前,一个字段是无法以任何形式拥有多个索引的,或许有人会想知道为什么通常一个字段需要多重索引,事实上需要多重索引的字段或者字段集合使很多的,经常会用到我们的调优测试,子啊12cr1 中只要索引类型的形式不相同,一个字段就可以包含在一个B-tree,bitmap,context索引中,同理 btree的hash,反向 亦然。
下面是我CRT的操作记录:
SQL> show user
USER is "PDB3"
SQL> show con_name
CON_NAME
------------------------------
PDB3
SQL> create table test ( id number(10),name varchar2(20),sal number(10));
Table created.
SQL> desc test
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER(10)
NAME VARCHAR2(20)
SAL NUMBER(10)
SQL> insert into test values ('1','a','1');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
ID NAME SAL
---------- -------------------- ----------
1 a 1
SQL> alter table test modify (sal invisible);
Table altered.
SQL> select * from test;
ID NAME
---------- --------------------
1 a
SQL> create index test_name_idx on test(name);
Index created.
SQL> create bitmap index test_name_bmp on test(name);
create bitmap index test_name_bmp on test(name)
*
ERROR at line 1:
ORA-01408: such column list already indexed
SQL> create bitmap index test_name_bmp on test(name) invisible;
Index created.
SQL> create index test_id_name_idx on test(id,name);
Index created.
SQL> select index_name,column_name,table_name from user_ind_columns where table_name='TEST';
INDEX_NAME COLUMN_NAME TABLE_NAME
------------------------------ ------------------------------ ------------------------------
TEST_NAME_IDX NAME TEST
TEST_NAME_BMP NAME TEST
TEST_ID_NAME_IDX ID TEST
TEST_ID_NAME_IDX NAME TEST
SQL> drop index test_id_name_idx;
Index dropped.
SQL> select index_name,column_name,table_name from user_ind_columns where table_name='TEST';
INDEX_NAME COLUMN_NAME TABLE_NAME
------------------------------ ------------------------------ ------------------------------
TEST_NAME_IDX NAME TEST
TEST_NAME_BMP NAME TEST
SQL> create index test_name_hash on test(name) invisible global partition by hash (name);
Index created.
SQL> select index_name,column_name,table_name from user_ind_columns where table_name='TEST';
INDEX_NAME COLUMN_NAME TABLE_NAME
------------------------------ ------------------------------ ------------------------------
TEST_NAME_IDX NAME TEST
TEST_NAME_BMP NAME TEST
TEST_NAME_HASH NAME TEST
SQL> create index test_name_hash_2 on test(name) invisible global partition by hash (name);
create index test_name_hash_2 on test(name) invisible global partition by hash (name)
*
ERROR at line 1:
ORA-01408: such column list already indexed
SQL> create index TEST_NAME_context on test (name) indextype is ctxsys.context invisible;
Index created.
SQL> select index_name,column_name,table_name from user_ind_columns where table_name='TEST';
INDEX_NAME COLUMN_NAME TABLE_NAME
------------------------------ ------------------------------ ------------------------------
TEST_NAME_IDX NAME TEST
TEST_NAME_BMP NAME TEST
TEST_NAME_CONTEXT NAME TEST
TEST_NAME_HASH NAME TEST
|
|