How to create multiple indexes for the same column in ORACLE 12C

Source: Internet
Author: User

Creating Multiple indexes in the same column does not seem to be implemented in other databases, but now ORACLE 12C can be implemented, the following describes how to create multiple indexes in the same column.

From ORACLE 12C, different types of indexes can be created on the same column for performance optimization. Different types of indexes mainly include (B * TREE vs BITMAP, Local vs Global)
ORACLE 11G

The Code is as follows: Copy code

SQL> select * from v $ version;


BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-Production

PL/SQL Release 11.2.0.3.0-Production

CORE 11.2.0.3.0 Production

TNS for Linux: Version 11.2.0.3.0-Production

NLSRTL Version 11.2.0.3.0-Production

 

SQL> CREATE TABLE T_XIFENFEI

2 (

3 empno number (9) primary key,

4 EMPNAME VARCHAR2 (15) not null,

5)

6/

 

Table created.

 

SQL> CREATE INDEX EMP_DEPT_BTREE_IDX ON EMP (DEPTNO );

 

Index created.

 

SQL> CREATE BITMAP INDEX EMP_DEPTNO_BITMAP_IDX ON EMP (DEPTNO) INVISIBLE;

Create bitmap index EMP_DEPTNO_BITMAP_IDX on emp (DEPTNO) INVISIBLE

*

ERROR at line 1:

ORA-01408: such column list already indexed


ORACLE 12C

CDB_PDB @ CHF> select * from v $ version;

 

BANNER CON_ID

------------------------------------------------------------------------------------------

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit Production 0

PL/SQL Release 12.1.0.1.0-Production 0

CORE 12.1.0.1.0 Production 0

TNS for 64-bit Windows: Version 12.1.0.1.0-Production 0

NLSRTL Version 12.1.0.1.0-Production 0

 

CDB_PDB @ CHF> create table T_XIFENFEI

2 (

3 empno number (9) primary key,

4 EMPNAME VARCHAR2 (15) NOT NULL

5)

6/

The table has been created.

The Code is as follows: Copy code


CDB_PDB @ CHF> create index EMP_DEPT_BTREE_IDX on emp (DEPTNO );

The index has been created.

The Code is as follows: Copy code

 

CDB_PDB @ CHF> create bitmap index EMP_DEPTNO_BITMAP_IDX on emp (DEPTNO );

Create bitmap index EMP_DEPTNO_BITMAP_IDX on emp (DEPTNO)

*

Row 3 has an error:

ORA-01408: This column list is indexed


CDB_PDB @ CHF> create bitmap index EMP_DEPTNO_BITMAP_IDX on emp (DEPTNO) INVISIBLE;


The index has been created.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.