Can We Create Multiple Indexes on the Same Column in Oracle

Answer: Yes! Oracle allows us to create multiple indexes on the same column, provided the index definitions are different and satisfy Oracle's index restrictions.
For example, we can create:
  • Normal Index
  • Function-Based Index
  • Bitmap Index
  • Unique Index, subject to compatibility with other indexes
However, Oracle generally does not allow duplicate indexes with exactly the same column definition and indexing characteristics. Let's understand this concept with practical examples.

1. Create an EMPLOYEE Table

First, create an EMPLOYEE table with four columns.
CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    SALARY NUMBER
);
Insert sample records:
INSERT INTO EMPLOYEE VALUES
(101, 'Ravi', 10, 30000);

INSERT INTO EMPLOYEE VALUES
(102, 'Kumar', 20, 40000);

INSERT INTO EMPLOYEE VALUES
(103, 'Sita', 10, 50000);

COMMIT;

2. Example 1: Normal Index and Function-Based Index on the Same Column

First, create a Normal Index on EMP_NAME.

Normal Index

CREATE INDEX IDX_EMP_NAME
ON EMPLOYEE(EMP_NAME);
Now create a Function-Based Index on the same column.

Function-Based Index

CREATE INDEX IDX_EMP_UPPER_NAME
ON EMPLOYEE(UPPER(EMP_NAME));
Important: Both indexes can exist on the same table because they index different expressions.

What Is the Difference?

Index Indexed Expression
IDX_EMP_NAME EMP_NAME
IDX_EMP_UPPER_NAME UPPER(EMP_NAME)

Query 1: Using Normal Index

SELECT *
FROM EMPLOYEE
WHERE EMP_NAME = 'Ravi';
Oracle may use: IDX_EMP_NAME

Query 2: Using Function-Based Index

SELECT *
FROM EMPLOYEE
WHERE UPPER(EMP_NAME) = 'RAVI';
Oracle may use: IDX_EMP_UPPER_NAME The optimizer decides which access path is most efficient.

3. Example 2: B-tree Index and Bitmap Index on the Same Column

Oracle also supports different index types on the same column, subject to applicable restrictions. First, create a B-tree Index.

B-tree Index

CREATE INDEX IDX_EMP_DEPT
ON EMPLOYEE(DEPT_ID);
Now create a Bitmap Index on the same column.

Bitmap Index

CREATE BITMAP INDEX IDX_EMP_DEPT_BITMAP
ON EMPLOYEE(DEPT_ID);
Both indexes are based on DEPT_ID, but their internal structures are different.

B-tree Index vs Bitmap Index

B-tree Index Bitmap Index
Uses a B-tree structure Uses bitmap structures
Good for high-cardinality columns Often useful for low-cardinality columns
Common in OLTP systems Common in Data Warehousing
Generally suitable for frequent DML Can be problematic with frequent concurrent DML
Note: Although Oracle supports different index types, maintaining both on the same column is generally unnecessary unless there is a specific performance requirement. Additional indexes increase storage and DML overhead.

4. Example 3: Can We Create Two Normal Indexes on the Same Column?

Suppose we create the following index.
CREATE INDEX IDX_EMP_NAME1
ON EMPLOYEE(EMP_NAME);
Now try creating another Normal Index on the same column.
CREATE INDEX IDX_EMP_NAME2
ON EMPLOYEE(EMP_NAME);
Oracle generally returns the following error:
ORA-01408: such column list already indexed
Why? Because both indexes have the same column definition and indexing characteristics. Creating an identical index does not provide additional benefits.
Interview Point: Changing only the index name does not make an otherwise identical index definition different.

5. Visual Representation: Multiple Indexes on the Same Column

Let's understand this with a simple diagram.
EMPLOYEE TABLE
EMP_NAME COLUMN
IDX_EMP_NAME
Normal Index
EMP_NAME
IDX_EMP_UPPER_NAME
Function-Based Index
UPPER(EMP_NAME)

Two different index definitions based on the same table column.

6. How to Check Multiple Indexes on the Same Column?

We can use Oracle data dictionary views to check the indexes created on a table.

Query 1: Check Index Columns

SELECT
    INDEX_NAME,
    TABLE_NAME,
    COLUMN_NAME,
    COLUMN_POSITION
FROM USER_IND_COLUMNS
WHERE TABLE_NAME = 'EMPLOYEE'
ORDER BY COLUMN_NAME, INDEX_NAME;
This query displays the indexed columns and their positions.

Query 2: Check Index Types

SELECT
    INDEX_NAME,
    INDEX_TYPE,
    UNIQUENESS
FROM USER_INDEXES
WHERE TABLE_NAME = 'EMPLOYEE';
This query displays the index type and uniqueness information.

Query 3: Check Function-Based Index Expressions

SELECT
    INDEX_NAME,
    COLUMN_EXPRESSION
FROM USER_IND_EXPRESSIONS
WHERE TABLE_NAME = 'EMPLOYEE';
This query helps us identify expressions used in Function-Based Indexes.

7. Important Oracle Interview Questions

Q1. Can we create multiple indexes on the same column in Oracle?

Answer: Yes. Oracle supports multiple indexes on the same column when their definitions differ appropriately.

Q2. Can we create a Normal Index and Function-Based Index on the same column?

Answer: Yes.

CREATE INDEX IDX1
ON EMPLOYEE(EMP_NAME);

CREATE INDEX IDX2
ON EMPLOYEE(UPPER(EMP_NAME));

Q3. Can we create a B-tree Index and Bitmap Index on the same column?

Answer: Oracle supports different index types on the same column, subject to applicable restrictions.

Q4. Can we create two identical Normal Indexes on the same column?

Answer: Generally, no. Oracle raises ORA-01408 when the same column list is already indexed.

Q5. Is it recommended to create multiple indexes on the same column?

Answer: Not usually. Create multiple indexes only when there is a specific performance requirement.

8. Easy Way to Remember

Scenario Allowed?
Normal + Function-Based Index Yes
B-tree + Bitmap Index Yes, subject to restrictions
Two identical Normal Indexes Generally No
Different expressions on same column Yes

9. One-Line Oracle Interview Answer

"Yes, Oracle allows multiple indexes on the same column if their definitions or index characteristics differ, such as a Normal Index and a Function-Based Index. However, creating two identical indexes on the same column generally raises ORA-01408."

Next Important Oracle Interview Topic

Can Oracle Use Multiple Indexes on the Same Column or Combine Multiple Indexes in a Single SQL Query? What is INDEX MERGE and BITMAP CONVERSION? Understanding these concepts is useful for analyzing Oracle execution plans and preparing for Oracle SQL interviews.

Can We Create Multiple Indexes on a Single Table in Oracle

Answer: Yes! Oracle allows us to create multiple indexes on a single table to improve query performance for different columns and query conditions.
However, each index requires additional storage and maintenance during INSERT, UPDATE and DELETE operations. Let's understand this concept with a practical example.

1. Create an EMPLOYEE Table

First, let's create an EMPLOYEE table with five columns.
CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    SALARY NUMBER,
    EMAIL VARCHAR2(100)
);
Insert sample records:
INSERT INTO EMPLOYEE VALUES
(101, 'Ravi', 10, 30000, 'ravi@gmail.com');

INSERT INTO EMPLOYEE VALUES
(102, 'Kumar', 20, 40000, 'kumar@gmail.com');

INSERT INTO EMPLOYEE VALUES
(103, 'Sita', 10, 50000, 'sita@gmail.com');

COMMIT;

2. Create Multiple Indexes on the Same Table

Let's create five different indexes on the EMPLOYEE table.

Index 1: Index on EMP_ID

CREATE UNIQUE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

Index 2: Index on EMP_NAME

CREATE INDEX IDX_EMP_NAME
ON EMPLOYEE(EMP_NAME);

Index 3: Index on DEPT_ID

CREATE INDEX IDX_EMP_DEPT
ON EMPLOYEE(DEPT_ID);

Index 4: Index on SALARY

CREATE INDEX IDX_EMP_SALARY
ON EMPLOYEE(SALARY);

Index 5: Index on EMAIL

CREATE INDEX IDX_EMP_EMAIL
ON EMPLOYEE(EMAIL);
Important: Now our EMPLOYEE table has five different indexes.

Visual Representation: One Table and Five Indexes

EMPLOYEE TABLE
One Database Table
IDX_EMP_ID
EMP_ID
IDX_EMP_NAME
EMP_NAME
IDX_EMP_DEPT
DEPT_ID
IDX_EMP_SALARY
SALARY
IDX_EMP_EMAIL
EMAIL

5 Indexes on 1 Table

3. How Does Oracle Use Multiple Indexes?

Suppose we execute different SQL queries on the EMPLOYEE table.

Query 1: Search Using EMP_ID

SELECT *
FROM EMPLOYEE
WHERE EMP_ID = 101;
Oracle may use: IDX_EMP_ID

Query 2: Search Using EMP_NAME

SELECT *
FROM EMPLOYEE
WHERE EMP_NAME = 'Ravi';
Oracle may use: IDX_EMP_NAME

Query 3: Search Using DEPT_ID

SELECT *
FROM EMPLOYEE
WHERE DEPT_ID = 10;
Oracle may use: IDX_EMP_DEPT

Query 4: Search Using SALARY

SELECT *
FROM EMPLOYEE
WHERE SALARY = 40000;
Oracle may use: IDX_EMP_SALARY

Query 5: Search Using EMAIL

SELECT *
FROM EMPLOYEE
WHERE EMAIL = 'ravi@gmail.com';
Oracle may use: IDX_EMP_EMAIL
The Oracle Optimizer decides which index, if any, is most efficient for each SQL query. Creating an index does not guarantee that Oracle will always use it.

4. Can Oracle Use Multiple Indexes in a Single Query?

Yes! Oracle can use multiple indexes in a single query when the optimizer determines that combining them is beneficial. For example:
SELECT *
FROM EMPLOYEE
WHERE DEPT_ID = 10
AND SALARY = 30000;
Suppose we have:
  • IDX_EMP_DEPT on DEPT_ID
  • IDX_EMP_SALARY on SALARY
Oracle may choose to use both indexes and combine their ROWIDs using an operation such as AND-EQUAL or bitmap conversion, depending on the index types and execution plan. However, Oracle might also choose just one index or a Full Table Scan if that is cheaper.
Interview Point: Oracle does not always use multiple indexes for a single query. The Cost-Based Optimizer chooses the most efficient execution plan.

5. Can We Create Multiple Indexes on the Same Column?

Yes. Oracle supports multiple indexes on the same column in certain cases, provided their definitions are valid. For example, we can create a normal index and a function-based index.

Normal Index

CREATE INDEX IDX_EMP_NAME
ON EMPLOYEE(EMP_NAME);

Function-Based Index

CREATE INDEX IDX_EMP_NAME_UPPER
ON EMPLOYEE(UPPER(EMP_NAME));
Here:
  • The first index is a Normal Index.
  • The second index is a Function-Based Index.
Both are based on EMP_NAME, but they index different expressions. The function-based index can help queries such as:
SELECT *
FROM EMPLOYEE
WHERE UPPER(EMP_NAME) = 'RAVI';

6. How to Check All Indexes Created on a Table?

We can use the USER_INDEXES data dictionary view to check all indexes created on a table.
SELECT
    INDEX_NAME,
    TABLE_NAME,
    UNIQUENESS
FROM USER_INDEXES
WHERE TABLE_NAME = 'EMPLOYEE';
Example Output:
INDEX_NAME TABLE_NAME UNIQUENESS
IDX_EMP_ID EMPLOYEE UNIQUE
IDX_EMP_NAME EMPLOYEE NONUNIQUE
IDX_EMP_DEPT EMPLOYEE NONUNIQUE
IDX_EMP_SALARY EMPLOYEE NONUNIQUE
IDX_EMP_EMAIL EMPLOYEE NONUNIQUE

7. What Happens When We INSERT, UPDATE or DELETE with Multiple Indexes?

Suppose our EMPLOYEE table has five indexes.
Operation What Happens?
INSERT Oracle maintains all five applicable indexes.
UPDATE EMP_ID Oracle updates the EMP_ID index.
UPDATE SALARY Oracle updates the SALARY index.
UPDATE EMP_NAME Oracle updates the EMP_NAME index.
DELETE Oracle removes corresponding entries from all five indexes.
This is why creating too many unnecessary indexes can reduce DML performance.

8. Important Oracle Interview Questions

Q1. Can we create multiple indexes on a single table?

Answer: Yes. Oracle supports multiple indexes on the same table.

Q2. Is there a fixed limit of five indexes per table?

Answer: No. Oracle does not impose a general five-index limit. Practical limits depend on database version and other restrictions.

Q3. Can Oracle use two indexes in one SQL query?

Answer: Yes. Oracle can combine multiple indexes when the optimizer determines that doing so is beneficial.

Q4. Does creating more indexes always improve SELECT performance?

Answer: No. More indexes consume storage and increase INSERT, UPDATE and DELETE overhead.

Q5. Can we create a Normal Index and Function-Based Index on the same column?

Answer: Yes, provided the index definitions are valid.

9. Easy Way to Remember for Interviews

One Table → Multiple Indexes
  • We can create multiple indexes on one table.
  • Each index can support different query conditions.
  • Oracle can use one or multiple indexes depending on the execution plan.
  • Too many indexes can increase DML overhead and storage requirements.

One-Line Interview Answer

"Yes, Oracle allows us to create multiple indexes on a single table. We can create indexes on different columns or expressions to improve query performance. However, additional indexes increase storage requirements and DML maintenance overhead."

Next Important Oracle Interview Topic

Can Oracle Use Multiple Indexes in a Single SQL Query? What is INDEX MERGE and BITMAP CONVERSION? Understand these Oracle execution plan concepts in the next tutorial!

Does Oracle Automatically Create Indexes for Foreign Keys

No! Oracle does NOT automatically create an index on Foreign Key columns.

This is an important Oracle interview question.

When we create a Foreign Key constraint, Oracle enforces referential integrity, but it does not automatically create an index on the Foreign Key column.

Let's understand with a practical example.

1. Create a DEPARTMENT Table (Parent Table)

First, create the DEPARTMENT table:

CREATE TABLE DEPARTMENT
(
    DEPT_ID NUMBER PRIMARY KEY,
    DEPT_NAME VARCHAR2(50)
);

Here, DEPT_ID is the Primary Key.

Oracle automatically creates a suitable index to support the Primary Key if one does not already exist.

2. Create an EMPLOYEE Table (Child Table)

Now create the EMPLOYEE table:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER PRIMARY KEY,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    CONSTRAINT FK_EMP_DEPT
    FOREIGN KEY (DEPT_ID)
    REFERENCES DEPARTMENT(DEPT_ID)
);

Here:

  • EMP_ID is the Primary Key.
  • DEPT_ID is the Foreign Key.
  • FK_EMP_DEPT is the Foreign Key constraint.
Important: Oracle automatically creates a suitable index for EMP_ID because it is a Primary Key, but does not automatically create an index for DEPT_ID because it is a Foreign Key.
DEPARTMENT (PARENT TABLE)
↓
DEPT_ID (PRIMARY KEY)
↓
EMPLOYEE (CHILD TABLE)
↓
DEPT_ID (FOREIGN KEY)

Foreign Key maintains the relationship between the two tables.

3. How to Verify Whether Oracle Created an Index?

Execute the following query:

SELECT
    INDEX_NAME,
    TABLE_NAME,
    UNIQUENESS
FROM USER_INDEXES
WHERE TABLE_NAME IN ('EMPLOYEE', 'DEPARTMENT');

Example output:

INDEX_NAME TABLE_NAME UNIQUENESS
SYS_C001001 DEPARTMENT UNIQUE
SYS_C001002 EMPLOYEE UNIQUE

Notice that there is no index on EMPLOYEE.DEPT_ID.

4. Why Should We Create an Index on a Foreign Key?

Let's understand with an example.

Suppose DEPARTMENT contains:

DEPT_ID DEPT_NAME
10HR
20IT
30SALES

EMPLOYEE contains:

EMP_ID EMP_NAME DEPT_ID
101Ravi10
102Kumar20
103Sita10
104Raju20
105Priya30

Now execute:

SELECT *
FROM EMPLOYEE
WHERE DEPT_ID = 10;

If there is no index on EMPLOYEE.DEPT_ID, Oracle may perform a Full Table Scan.

For a large employee table, this could be expensive.

Solution: Create an Index on the Foreign Key

Execute:

CREATE INDEX IDX_EMP_DEPT
ON EMPLOYEE(DEPT_ID);

Now Oracle can consider using the index to find employees belonging to a particular department.

Possible Execution Plan

------------------------------------------------
| Id | Operation                    | Name     |
------------------------------------------------
|  0 | SELECT STATEMENT              |          |
|  1 | TABLE ACCESS BY INDEX ROWID   | EMPLOYEE |
|  2 | INDEX RANGE SCAN              | IDX_EMP_DEPT |
------------------------------------------------
Performance Tip: An index on a Foreign Key can improve child-table lookups. However, the optimizer decides whether an index scan or full table scan is more efficient.

5. Important Scenario: What Happens When We DELETE a Parent Table Record?

This is one of the most important reasons DBAs often create indexes on Foreign Key columns.

Suppose we execute:

DELETE FROM DEPARTMENT
WHERE DEPT_ID = 10;

But employees belonging to department 10 still exist.

What Happens Internally?

  • Oracle checks whether child records reference DEPT_ID = 10.
  • Without an index on the Foreign Key, Oracle may need to scan the EMPLOYEE table.
  • With an index, Oracle can efficiently locate matching child records.

If matching child records exist, Oracle rejects the parent DELETE because of the Foreign Key constraint.

Oracle returns:

ORA-02292: integrity constraint violated
- child record found

What If We Use ON DELETE CASCADE?

Example:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER PRIMARY KEY,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    CONSTRAINT FK_EMP_DEPT
    FOREIGN KEY (DEPT_ID)
    REFERENCES DEPARTMENT(DEPT_ID)
    ON DELETE CASCADE
);

Now, when we delete a department:

DELETE FROM DEPARTMENT
WHERE DEPT_ID = 10;

Oracle automatically deletes the employees belonging to department 10.

An index on EMPLOYEE.DEPT_ID can help Oracle locate those child records efficiently.

Important: An unindexed Foreign Key can also contribute to locking and concurrency problems during parent-table DELETE or referenced key UPDATE operations. Indexing the Foreign Key is often recommended when appropriate.

6. Difference Between Primary Key Index and Foreign Key Index

Feature Primary Key Foreign Key
Purpose Uniquely identifies a record References parent table
Automatically creates index? Yes, if needed No
Duplicate values Not allowed Allowed
NULL values Not allowed Allowed unless separately restricted
Index type commonly used Unique Index Non-Unique Index
Index recommended? Yes, automatically supported Often recommended

7. How to Check Whether a Foreign Key Has an Index?

Execute the following query:

SELECT
    C.CONSTRAINT_NAME,
    C.TABLE_NAME,
    C.CONSTRAINT_TYPE,
    I.INDEX_NAME,
    I.UNIQUENESS
FROM USER_CONSTRAINTS C
LEFT JOIN USER_INDEXES I
    ON C.INDEX_NAME = I.INDEX_NAME
WHERE C.TABLE_NAME = 'EMPLOYEE'
AND C.CONSTRAINT_TYPE = 'R';
Note: This query shows an index associated with a constraint when applicable. A separately created Foreign Key index might not appear through this constraint association.

Better Way: Inspect All Index Columns

To identify indexes created on EMPLOYEE columns, execute:

SELECT
    INDEX_NAME,
    COLUMN_NAME,
    COLUMN_POSITION
FROM USER_IND_COLUMNS
WHERE TABLE_NAME = 'EMPLOYEE'
ORDER BY INDEX_NAME, COLUMN_POSITION;

This query helps identify whether an index exists on DEPT_ID, including indexes where DEPT_ID is a leading column.

8. Important Oracle Interview Questions

Q1. Does Oracle automatically create an index for a Foreign Key?

No. Oracle does not automatically create an index on Foreign Key columns. We need to create it explicitly if required.

Q2. Why do DBAs create indexes on Foreign Keys?

To improve queries on child tables and reduce unnecessary child-table scanning during parent DELETE or Primary Key/Unique Key updates.

Q3. Is a Foreign Key index always mandatory?

No. It depends on application queries, table size, and DML workload.

Q4. Can a Foreign Key have duplicate values?

Yes. Multiple employees can belong to the same department.

Q5. What happens when we delete a parent record without a Foreign Key index?

Oracle may need to scan the child table to check for referencing rows. The DELETE can also cause locking and concurrency issues in some scenarios.

9. Easy Way to Remember for Interviews

Primary Key

  • Oracle automatically creates a suitable index if needed.
  • A unique index is commonly used.
  • Duplicate and NULL values are not allowed.

Foreign Key

  • Oracle does not automatically create an index.
  • We create a non-unique index when appropriate.
  • Helps improve child-table lookups.
  • Can reduce locking and concurrency issues during parent-table DELETE or key UPDATE operations.
PRIMARY KEY
↓
INDEX CREATED IF NEEDED

FOREIGN KEY
↓
INDEX NOT CREATED AUTOMATICALLY
↓
CREATE INDEX WHEN APPROPRIATE

One-Line Interview Answer

"Oracle does not automatically create indexes on Foreign Key columns. We need to create them manually when required, because Foreign Key indexes can improve query performance and reduce locking and concurrency issues during parent-table DELETE or key UPDATE operations."

Next Important Oracle Interview Topic

What is the Difference Between DELETE, TRUNCATE and DROP in Oracle?

Understanding their internal behavior, undo generation, transaction properties, and index handling is very useful for Oracle DBA and SQL Developer interviews.

Does Oracle Automatically Create Indexes for Primary Keys

Yes! Oracle automatically creates a UNIQUE INDEX to enforce a PRIMARY KEY constraint if a suitable existing index is not available.

A Primary Key has two important properties:

  1. It does not allow duplicate values.
  2. It does not allow NULL values.

Oracle uses an index to efficiently enforce the uniqueness requirement.

Let's understand with practical examples.

1. Create a Table with a Primary Key

Consider the following CREATE TABLE statement:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER PRIMARY KEY,
    EMP_NAME VARCHAR2(50),
    SALARY NUMBER
);

What Happens Internally?

  • Oracle creates the EMPLOYEE table.
  • Oracle creates a Primary Key constraint on EMP_ID.
  • Oracle automatically creates a unique index on EMP_ID if no suitable index already exists.
EMPLOYEE TABLE
↓
EMP_ID (PRIMARY KEY)
↓
UNIQUE + NOT NULL
↓
UNIQUE INDEX

Oracle uses index support to enforce uniqueness.

2. How to Verify Whether Oracle Created an Index?

Execute the following query:

SELECT
    INDEX_NAME,
    TABLE_NAME,
    UNIQUENESS
FROM USER_INDEXES
WHERE TABLE_NAME = 'EMPLOYEE';

Example output:

INDEX_NAME TABLE_NAME UNIQUENESS
SYS_C008123 EMPLOYEE UNIQUE

The index name may be system-generated.

Check the Primary Key Constraint

Execute:

SELECT
    CONSTRAINT_NAME,
    CONSTRAINT_TYPE,
    TABLE_NAME
FROM USER_CONSTRAINTS
WHERE TABLE_NAME = 'EMPLOYEE';

Example output:

CONSTRAINT_NAME CONSTRAINT_TYPE TABLE_NAME
SYS_C008123 P EMPLOYEE

Here:

  • P means Primary Key.
  • U means Unique Constraint.

3. What Happens When We Insert Duplicate Values?

Let's insert some records:

INSERT INTO EMPLOYEE
VALUES (101, 'Ravi', 30000);

INSERT INTO EMPLOYEE
VALUES (102, 'Kumar', 40000);

COMMIT;

Now try inserting a duplicate EMP_ID:

INSERT INTO EMPLOYEE
VALUES (101, 'Sita', 50000);

Oracle returns:

ORA-00001: unique constraint violated

Why?

Because EMP_ID = 101 already exists, and the Primary Key constraint does not allow duplicate values.

Important: The Primary Key constraint enforces uniqueness and NOT NULL requirements. Oracle uses index support to enforce uniqueness efficiently.

4. Does Oracle Always Create a New Index for a Primary Key?

No! This is a very important Oracle interview concept.

If a suitable existing index is available, Oracle can use that index to enforce the Primary Key instead of creating another index.

Example: Create a Unique Index Manually

First, create a table:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER,
    EMP_NAME VARCHAR2(50),
    SALARY NUMBER
);

Now create a unique index manually:

CREATE UNIQUE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

Next, add a Primary Key constraint:

ALTER TABLE EMPLOYEE
ADD CONSTRAINT PK_EMP_ID
PRIMARY KEY (EMP_ID);

What Happens?

  • Oracle uses the existing unique index.
  • Oracle does not need to create another index.
  • The existing index helps enforce the Primary Key constraint.
Interview Tip: Oracle does not necessarily create a new index whenever we add a Primary Key. It can reuse a suitable existing index.

5. Can We Create a Primary Key Using a Non-Unique Index?

Yes! Oracle can use an existing non-unique index to enforce a Primary Key constraint.

Example:

CREATE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

Then add the Primary Key:

ALTER TABLE EMPLOYEE
ADD CONSTRAINT PK_EMP_ID
PRIMARY KEY (EMP_ID);

Oracle can use the existing non-unique index to enforce uniqueness through the constraint.

This is an important distinction:

  • A Primary Key constraint does not always require a physically UNIQUE index.
  • Oracle can enforce uniqueness using a non-unique index as well.
  • The constraint itself guarantees that duplicate Primary Key values are not allowed.
Remember: A UNIQUE index and a Primary Key constraint are different database objects. A Primary Key is a constraint, whereas an index is a separate database object used for access and enforcement.

6. Difference Between Primary Key and Unique Index

Feature Primary Key Unique Index
Purpose Enforces a business rule Enforces unique index keys
Duplicate values Not allowed Not allowed
NULL values Not allowed Multiple NULLs allowed in a single-column index
Automatically created? Oracle may create an index when needed Created explicitly using CREATE UNIQUE INDEX
Foreign Key reference Can be referenced Cannot be referenced directly
Database object Constraint Index

7. Important Oracle Interview Questions

Q1. Does Oracle automatically create an index for a Primary Key?

Yes. Oracle automatically creates a unique index if a suitable existing index is not available.

Q2. Does Oracle create a separate index if one already exists?

Not necessarily. Oracle can use a suitable existing index.

Q3. Can a Primary Key use a Non-Unique Index?

Yes. Oracle can use a non-unique index to enforce Primary Key uniqueness.

Q4. Can we drop the index created for a Primary Key?

Not directly while it is being used to enforce the constraint. You generally need to disable or drop the constraint first, depending on the situation.

Q5. Does Oracle automatically create an index for a Foreign Key?

No. Oracle does not automatically create an index on Foreign Key columns. You generally create one when appropriate for query performance and concurrency.

8. Easy Way to Remember

PRIMARY KEY
↓
UNIQUE + NOT NULL
↓
INDEX SUPPORT

Oracle creates a suitable index if needed or reuses an existing one.

  • Primary Key guarantees UNIQUE and NOT NULL.
  • Oracle automatically creates a suitable index if needed.
  • An existing suitable index can be reused.
  • A Foreign Key does not automatically get an index.

One-Line Interview Answer

"Yes, Oracle automatically creates a unique index when we create a Primary Key constraint, provided a suitable existing index is not available. However, Oracle can also use an existing unique or non-unique index to enforce the Primary Key constraint."

Next Important Oracle Interview Topic

Does Oracle Automatically Create Indexes for Foreign Keys?

Understanding Primary Key indexes versus Foreign Key indexes is very useful for Oracle DBA and SQL Developer interviews.

What Happens When We DELETE Records from an Indexed Table in Oracle

When we delete a record from an Oracle table that has indexes, Oracle deletes the corresponding row from the table and removes the associated index entries.

In simple words:

  1. Oracle identifies the record to be deleted.
  2. It deletes the row from the table logically.
  3. It removes the corresponding entries from all applicable indexes.
  4. Oracle maintains consistency between the table and its indexes.

Let's understand with a practical example.

1. Create an EMPLOYEE Table

First, create an EMPLOYEE table:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    SALARY NUMBER
);

Insert some records:

INSERT INTO EMPLOYEE VALUES (101, 'Ravi', 10, 30000);
INSERT INTO EMPLOYEE VALUES (102, 'Kumar', 20, 40000);
INSERT INTO EMPLOYEE VALUES (103, 'Sita', 10, 50000);
INSERT INTO EMPLOYEE VALUES (104, 'Raju', 30, 60000);

COMMIT;

Our table looks like this:

EMP_ID EMP_NAME DEPT_ID SALARY
101Ravi1030000
102Kumar2040000
103Sita1050000
104Raju3060000

2. Create Indexes on the Table

Let's create two indexes:

CREATE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

CREATE INDEX IDX_EMP_DEPT
ON EMPLOYEE(DEPT_ID);

Now we have:

  • EMPLOYEE table
  • IDX_EMP_ID
  • IDX_EMP_DEPT

Each index contains indexed values and corresponding ROWIDs.

EMPLOYEE TABLE

101, 102, 103, 104

↓
IDX_EMP_ID

Indexed EMP_ID values and ROWIDs

↓
IDX_EMP_DEPT

Indexed DEPT_ID values and ROWIDs

3. Now DELETE a Record

Execute:

DELETE FROM EMPLOYEE
WHERE EMP_ID = 102;

COMMIT;

We are deleting Kumar's record.

What Happens Internally?

Step 1: Oracle Identifies the Record

Oracle may use IDX_EMP_ID to locate EMP_ID = 102.

Step 2: Oracle Deletes the Table Row Logically

Before DELETE:

EMP_ID EMP_NAME DEPT_ID
102Kumar20

After DELETE:

The row is marked as deleted and is no longer visible to queries after the transaction commits.

Step 3: Oracle Removes the Corresponding Index Entries

Before DELETE – IDX_EMP_ID:

EMP_ID ROWID
101ROWID-1
102ROWID-2
103ROWID-3
104ROWID-4

After DELETE – IDX_EMP_ID:

EMP_ID ROWID
101ROWID-1
103ROWID-3
104ROWID-4

Similarly, Oracle removes the corresponding entry from IDX_EMP_DEPT.

Important: The ROWIDs shown above are illustrative. Oracle automatically maintains actual index entries and row locations.

4. DELETE Operation Flow

Let's understand the complete DELETE operation flow:

DELETE FROM EMPLOYEE WHERE EMP_ID = 102
↓
Find the Matching Record
↓
Delete the Table Row Logically
↓
Remove from IDX_EMP_ID
↓
Remove from IDX_EMP_DEPT
↓
Table and Indexes Remain Consistent
Important: Oracle performs the DELETE and index maintenance within the same transaction. COMMIT makes the changes permanent; ROLLBACK can undo them.

5. What Happens If We DELETE Multiple Records?

Execute:

DELETE FROM EMPLOYEE
WHERE DEPT_ID = 10;

COMMIT;

This deletes all employees belonging to department 10.

Oracle must:

  • Identify all matching rows.
  • Delete those rows logically from the table.
  • Remove the corresponding entries from all applicable indexes.

If many rows are deleted, index maintenance can add significant overhead.

6. Does Oracle Physically Remove Deleted Records Immediately?

This is an important Oracle interview question.

No. A DELETE does not necessarily remove the row's bytes from the data block immediately.

Oracle generally marks the row as deleted and maintains undo information.

Important points:

  • Undo information allows transaction rollback.
  • Undo also supports read consistency.
  • After COMMIT, other transactions can no longer see the deleted rows.
  • Space in the table block can generally be reused by future inserts.
  • Index entries are logically removed, but their block space may not immediately be returned to the operating system.
Remember: COMMIT does not immediately shrink the table or return its allocated space to the operating system. It commits the transaction.

7. What Happens When We DELETE Data from a Table with Multiple Indexes?

Suppose EMPLOYEE has five indexes.

When one record is deleted:

Object Operation
EMPLOYEE tableDelete the row
IDX_EMP_IDRemove corresponding entry
IDX_EMP_NAMERemove corresponding entry
IDX_EMP_DEPTRemove corresponding entry
IDX_EMP_SALARYRemove corresponding entry
IDX_EMP_EMAILRemove corresponding entry

All applicable index entries must be maintained.

Important: More indexes generally mean more DELETE overhead because Oracle must maintain all applicable indexes.

8. Difference Between DELETE, TRUNCATE and DROP

This is a very important Oracle interview question.

Feature DELETE TRUNCATE DROP
Purpose Deletes selected or all rows Removes all rows Removes entire table
WHERE condition Supported Not supported Not supported
DML or DDL DML DDL DDL
Rollback Possible before COMMIT Cannot rollback normally Cannot rollback normally
Indexes Maintained Remain but are reset/maintained as empty structures Dropped with the table
Triggers DELETE triggers fire DELETE triggers do not fire Not applicable
Table structure Remains Remains Removed

DELETE Example

DELETE FROM EMPLOYEE
WHERE EMP_ID = 102;

Deletes only the matching employee.

TRUNCATE Example

TRUNCATE TABLE EMPLOYEE;

Removes all rows but keeps the table structure and its indexes.

DROP Example

DROP TABLE EMPLOYEE;

Removes the entire table, including its indexes.

Important Oracle Concept: TRUNCATE and DROP are DDL statements and cause implicit transaction commits. They cannot be rolled back like an ordinary DELETE. Oracle also has special recovery options, such as Flashback features, depending on the operation and configuration.

9. Important Oracle Interview Questions

Q1. What happens to indexes when we delete a record?

Oracle removes the corresponding index entries automatically.

Q2. Do we need to rebuild indexes after DELETE?

No. Oracle automatically maintains indexes during DELETE operations.

Q3. Does DELETE remove index entries immediately?

Index changes are performed as part of the DELETE transaction. They become permanent after COMMIT.

Q4. Can we ROLLBACK a DELETE statement?

Yes, before COMMIT.

Example:

DELETE FROM EMPLOYEE
WHERE EMP_ID = 102;

ROLLBACK;

The deleted row is restored.

Q5. Does DELETE remove the index itself?

No. DELETE removes applicable index entries, not the index structure.

Q6. What happens when we delete all records using DELETE?

All rows are deleted logically, and applicable index entries are removed. The table and index structures remain.

10. Easy Way to Remember for Interviews

Operation Table Index
INSERT Adds a row Adds index entries
UPDATE indexed column Updates a row Removes old entry and adds new entry
DELETE Deletes a row logically Removes corresponding entries

One-Line Interview Answer

"When we delete a record from an indexed table in Oracle, Oracle logically deletes the table row and automatically removes the corresponding entries from all applicable indexes. The index structures themselves remain."

Next Important Oracle Performance Topic

DELETE vs TRUNCATE vs DROP in Oracle

Understanding their internal behavior, undo generation, transaction handling, and index maintenance is very useful for Oracle DBA and SQL Developer interviews.

What Happens When We UPDATE an Indexed Column in Oracle

When we update an indexed column in Oracle, Oracle updates both the table data and the corresponding index entries to maintain consistency.

In simple words:

  1. Oracle finds the existing record.
  2. It updates the column value in the table.
  3. It removes the old index entry.
  4. It inserts a new index entry with the updated value.
  5. The index remains synchronized with the table.

Let's understand with a practical example.

1. Create an EMPLOYEE Table

First, create an EMPLOYEE table:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    SALARY NUMBER
);

Insert some records:

INSERT INTO EMPLOYEE VALUES (101, 'Ravi', 10, 30000);
INSERT INTO EMPLOYEE VALUES (102, 'Kumar', 20, 40000);
INSERT INTO EMPLOYEE VALUES (103, 'Sita', 10, 50000);

COMMIT;

Our table looks like this:

EMP_ID EMP_NAME DEPT_ID SALARY
101Ravi1030000
102Kumar2040000
103Sita1050000

2. Create an Index on EMP_ID

Create a Normal Index on EMP_ID:

CREATE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

Conceptually, the index contains:

EMP_ID ROWID
101ROWID-1
102ROWID-2
103ROWID-3

Each index entry points to the corresponding table row.

Note: The ROWIDs shown in this example are illustrative. Actual Oracle ROWIDs identify physical row locations.

3. Now UPDATE the Indexed Column

Execute:

UPDATE EMPLOYEE
SET EMP_ID = 105
WHERE EMP_ID = 102;

COMMIT;

We changed EMP_ID from 102 to 105.

What Happens Internally?

Step 1: Oracle Finds the Existing Record

Oracle can use the index to locate EMP_ID = 102.

Step 2: Oracle Updates the Table

Before UPDATE:

EMP_ID EMP_NAME
102Kumar

After UPDATE:

EMP_ID EMP_NAME
105Kumar

Step 3: Oracle Updates the Index

Before UPDATE:

EMP_ID ROWID
101ROWID-1
102ROWID-2
103ROWID-3

After UPDATE:

EMP_ID ROWID
101ROWID-1
103ROWID-3
105ROWID-2

Notice what happened:

  • Old index entry 102 is removed.
  • New index entry 105 is inserted.
  • The ROWID continues to identify the same table row in this example.

4. UPDATE Operation Flow

Let's understand the complete UPDATE operation flow:

UPDATE EMPLOYEE SET EMP_ID = 105
↓
Find Existing Row: EMP_ID = 102
↓
Update Table Column: 102 → 105
↓
Remove Old Index Entry: 102
↓
Insert New Index Entry: 105
↓
Index Maintained Automatically

5. What Happens When We UPDATE a Non-Indexed Column?

This is another important interview concept.

Suppose we have an index only on EMP_ID.

Now execute:

UPDATE EMPLOYEE
SET SALARY = 60000
WHERE EMP_ID = 101;

COMMIT;

Here:

  • EMP_ID is indexed.
  • SALARY is not indexed.
  • We are updating SALARY only.

What Happens?

  1. Oracle finds the row using EMP_ID.
  2. Oracle updates SALARY in the table.
  3. The EMP_ID index entry generally does not need to change.
Important: Oracle generally does not need to modify an index when only a non-indexed column is updated, unless another applicable index or indexed expression depends on that column.

6. What Happens If We UPDATE a Column That Has Multiple Indexes?

Suppose we create two indexes:

CREATE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

CREATE INDEX IDX_EMP_NAME
ON EMPLOYEE(EMP_NAME);

Now execute:

UPDATE EMPLOYEE
SET EMP_NAME = 'Rahul'
WHERE EMP_ID = 101;

Oracle needs to:

  • Update the EMP_NAME value in the table.
  • Remove the old EMP_NAME index entry.
  • Insert the new EMP_NAME index entry.
  • Maintain the EMP_ID index as needed for the row. Since its key value has not changed, no key change is required.

7. Difference Between UPDATE Indexed and Non-Indexed Columns

Feature Update Indexed Column Update Non-Indexed Column
Table data updatedYesYes
Index maintenanceRequiredGenerally not required
Old index entryRemoved when key changesUnchanged
New index entryInserted when key changesNot required
DML overheadGenerally higherGenerally lower

8. What Happens If We UPDATE a Column in a Unique Index?

Suppose we have:

CREATE UNIQUE INDEX IDX_EMP_ID_UNQ
ON EMPLOYEE(EMP_ID);

Now execute:

UPDATE EMPLOYEE
SET EMP_ID = 101
WHERE EMP_ID = 105;

If EMP_ID = 101 already exists, Oracle returns:

ORA-00001: unique constraint violated

Why?

Because the updated value violates the unique index.

The UPDATE statement fails, and the existing value remains unchanged unless other transaction operations affect it.

Interview Point: A unique index prevents duplicate non-NULL key values. If an UPDATE attempts to create a duplicate key, Oracle raises ORA-00001.

9. Important Oracle Interview Questions

Q1. What happens when we update an indexed column?

Oracle updates the table row, removes the old index entry and inserts a new index entry containing the updated value.

Q2. What happens when we update a non-indexed column?

Oracle updates the table row, but generally does not need to modify indexes whose key values are unaffected.

Q3. Does Oracle automatically maintain indexes during UPDATE?

Yes. Oracle automatically maintains applicable indexes.

Q4. Does updating an indexed column affect performance?

Yes. It generally involves additional index-maintenance work compared with updating a non-indexed column.

Q5. What happens if the new value already exists in a Unique Index?

Oracle raises ORA-00001 and rejects the update.

Q6. Do we need to rebuild an index after UPDATE?

No. Oracle automatically maintains the index. Rebuilding after every UPDATE is unnecessary.

10. Difference Between INSERT, UPDATE and DELETE on Indexed Tables

DML Operation What Happens to Index?
INSERTNew index entry is inserted.
UPDATE indexed columnOld entry is removed and new entry is inserted.
UPDATE non-indexed columnGenerally no index key change.
DELETECorresponding index entries are removed.

11. Easy Way to Remember for Interviews

UPDATE Indexed Column = Table Update + Index Maintenance

  • Oracle finds the existing row.
  • Oracle updates the table column.
  • Old index key entry is removed when the key changes.
  • New index key entry is inserted.
  • Oracle automatically maintains index consistency.

One-Line Interview Answer

"When we update an indexed column in Oracle, the database updates the table row, deletes the old index key entry and inserts the new index key entry to maintain index consistency."

Next Important Interview Topic

What Happens Internally When We DELETE Data from an Indexed Table in Oracle?

Understanding INSERT, UPDATE and DELETE operations on indexed tables is very important for Oracle SQL performance tuning interviews.

What Happens When We INSERT Data into an Indexed Table in Oracle

When we insert a new record into an Oracle table that has indexes, Oracle performs two important operations:

  1. Inserts the new record into the table.
  2. Updates all applicable indexes by inserting the new index entries.
Important: Whenever we insert data into an indexed table, Oracle must maintain the indexes to keep them synchronized with the table data.

Let's understand with a practical example.

1. Create an EMPLOYEE Table

First, create an EMPLOYEE table:

CREATE TABLE EMPLOYEE
(
    EMP_ID NUMBER,
    EMP_NAME VARCHAR2(50),
    DEPT_ID NUMBER,
    SALARY NUMBER
);

Insert some records:

INSERT INTO EMPLOYEE VALUES (101, 'Ravi', 10, 30000);
INSERT INTO EMPLOYEE VALUES (102, 'Kumar', 20, 40000);
INSERT INTO EMPLOYEE VALUES (103, 'Sita', 10, 50000);

COMMIT;

Our table looks like this:

EMP_ID EMP_NAME DEPT_ID SALARY
101Ravi1030000
102Kumar2040000
103Sita1050000

2. Create Indexes on the Table

Let's create two indexes.

CREATE INDEX IDX_EMP_ID
ON EMPLOYEE(EMP_ID);

CREATE INDEX IDX_EMP_DEPT
ON EMPLOYEE(DEPT_ID);

Now we have:

  • One table: EMPLOYEE
  • First index: IDX_EMP_ID
  • Second index: IDX_EMP_DEPT

Table and Index Structure

EMPLOYEE TABLE

101, 102, 103

↓
IDX_EMP_ID IDX_EMP_DEPT

Both indexes are maintained when applicable table rows change.

3. Now INSERT a New Record

Execute:

INSERT INTO EMPLOYEE
VALUES (104, 'Raju', 30, 60000);

COMMIT;

What Happens Internally?

Step 1: Oracle Inserts the Record into the EMPLOYEE Table

EMP_ID EMP_NAME DEPT_ID SALARY
101Ravi1030000
102Kumar2040000
103Sita1050000
104Raju3060000

Step 2: Oracle Updates IDX_EMP_ID

The new EMP_ID value 104 and its ROWID are added to the index.

Conceptually:

EMP_ID ROWID
101ROWID-1
102ROWID-2
103ROWID-3
104ROWID-4

Step 3: Oracle Updates IDX_EMP_DEPT

The new DEPT_ID value 30 and its ROWID are added to this index.

Conceptually:

DEPT_ID ROWID
10ROWID-1
10ROWID-3
20ROWID-2
30ROWID-4
Note: The ROWIDs shown above are illustrative. Actual Oracle ROWIDs are physical row-location identifiers and will not necessarily look like these examples.

4. INSERT Operation Flow

Let's understand the complete INSERT operation flow:

INSERT INTO EMPLOYEE
↓
Insert Row into Table
↓
Update IDX_EMP_ID
↓
Update IDX_EMP_DEPT
↓
Table and Indexes Maintained

5. What Happens If a Table Has 5 Indexes?

Suppose the EMPLOYEE table has five indexes.

When you insert one new record, Oracle must maintain all five applicable indexes.

Operation Work Performed
TableInsert one row
Index 1Insert index entry
Index 2Insert index entry
Index 3Insert index entry
Index 4Insert index entry
Index 5Insert index entry

This means more indexes generally increase INSERT overhead.

Important: Not every index requires the same amount of work. Oracle may need to modify index blocks, allocate new blocks, or split a B-tree index block when necessary.

6. What Happens If We INSERT Duplicate Data into a Unique Index?

Suppose we create a Unique Index:

CREATE UNIQUE INDEX IDX_EMP_ID_UNQ
ON EMPLOYEE(EMP_ID);

Now try inserting an existing EMP_ID:

INSERT INTO EMPLOYEE
VALUES (101, 'Anil', 40, 70000);

Oracle returns:

ORA-00001: unique constraint violated

The insert fails because EMP_ID 101 already exists in the unique index.

The table and index remain consistent; the failed insert does not leave a committed duplicate row.

Remember: A UNIQUE index prevents duplicate indexed keys. For a single-column unique index, duplicate non-NULL values are not allowed. Oracle unique indexes can contain multiple NULL values.

7. Does INSERT Become Slower When Indexes Are Present?

Generally, yes.

Table Condition INSERT Performance
No indexesLess index-maintenance overhead
One indexAdditional index maintenance
Three indexesMore index maintenance
Ten indexesPotentially higher maintenance overhead

Why?

Because Oracle needs to maintain every applicable index whenever a row is inserted.

However, indexes can improve SELECT performance, so we need to balance read performance and write performance.

8. What Happens During UPDATE and DELETE?

This is another important Oracle interview question.

Operation What Happens to Indexes?
INSERTAdds new index entries
UPDATE indexed columnMaintains the old and new index entries
UPDATE non-indexed columnExisting index entries generally remain unchanged
DELETERemoves corresponding index entries

Example: UPDATE Indexed Column

UPDATE EMPLOYEE
SET EMP_ID = 105
WHERE EMP_ID = 104;

Oracle must maintain the EMP_ID index because the indexed value has changed.

Interview Tip: Updating a non-indexed column generally does not require changing ordinary indexes that do not depend on that column. However, indexes on expressions or other dependent columns may also require maintenance.

9. Important Oracle Interview Questions

Q1. What happens internally when we insert data into an indexed table?

Oracle inserts the row into the table and updates all applicable indexes with the new index entries and ROWIDs.

Q2. Does INSERT become slower when more indexes exist?

Generally yes, because Oracle has additional index-maintenance work.

Q3. Does Oracle update indexes automatically?

Yes. Oracle automatically maintains indexes during INSERT, UPDATE and DELETE operations.

Q4. What happens when we insert duplicate data into a Unique Index?

Oracle rejects the insert and raises ORA-00001.

Q5. Do we need to rebuild indexes after every INSERT?

No. Oracle automatically maintains indexes. Rebuilding after every INSERT is unnecessary.

Q6. Does COMMIT update the indexes?

Index maintenance happens as part of the INSERT transaction, not only at COMMIT. COMMIT makes the transaction's changes permanent and visible to other transactions according to Oracle's transaction rules.

10. Easy Way to Remember for Interviews

INSERT = Table Insert + Index Maintenance

  • New row is inserted into the table.
  • New index entries are added to all applicable indexes.
  • ROWIDs are maintained in the indexes.
  • More indexes can increase INSERT overhead.

One-Line Interview Answer

"When we insert a record into an indexed table, Oracle inserts the row into the table and automatically updates all applicable indexes with the new key values and ROWIDs. Therefore, having more indexes can increase INSERT overhead."

Next Important Interview Topic

What Happens Internally When We UPDATE and DELETE Data from an Indexed Table in Oracle?

Understanding INSERT, UPDATE and DELETE operations on indexed tables is very important for Oracle SQL performance tuning interviews.