Oracle and PostgreSQL invisible indexes - Oracle to Aurora PostgreSQL Migration Playbook

Oracle and PostgreSQL invisible indexes

With AWS DMS, you can create invisible indexes on Oracle and PostgreSQL databases to improve query performance without impacting the storage footprint. Invisible indexes are lightweight structures that store metadata about the indexed data, allowing the database optimizer to generate more efficient query plans without the overhead of maintaining a full index.

Feature compatibility AWS SCT / AWS DMS automation level AWS SCT action code index Key differences

One star feature compatibility

No automation

Indexes

PostgreSQL doesn’t support invisible indexes.

Oracle usage

In Oracle, the invisible index feature gives database administrators the ability to create indexes, or change existing indexes, that are ignored by the optimizer. They are maintained during DML operations and are kept relevant, but are different from usable indexes.

The most common uses for invisible indexes are:

  • Testing the effect of a dropped index without actually dropping it.

  • Using a specific index for certain operations or modules of an application without affecting the overall application.

  • Adding an index to a set of columns on which an index already exists.

Database administrators can force the optimizer to use invisible indexes by changing the OPTIMIZER_USE_INVISIBLE_INDEXES parameter to true. You can use invisible indexes if they are specified as a HINT.

Examples

Change an index to an invisible index.

ALTER INDEX idx_name INVISIBLE;

Change an invisible index to a visible index.

ALTER INDEX idx_name VISIBLE;

Create an invisible index.

CREATE INDEX idx_name ON employees(first_name) INVISIBLE;

Query all invisible indexes.

SELECT TABLE_OWNER, INDEX_NAME FROM DBA_INDEXES
  WHERE VISIBILITY = 'INVISIBLE';

For more information, see Understand When to Use Unusable or Invisible Indexes in the Oracle documentation.

PostgreSQL usage

Currently, Aurora PostgreSQL doesn’t provide a directly comparable alternative for Oracle invisible indexes.