top of page

Letting the Database Choose Its Indexes: Automatic Indexing on Exadata in Oracle Database@Azure

OmerNarman
Nov 21
7 min read

Indexes are rarely designed once and left alone. An application grows new screens, reports change, and the indexes that were created five years ago for a different workload stay in place. After a move to Exadata Database Service in Oracle Database@Azure, the question becomes sharper: some indexes are no longer needed because Smart Scan reads the table quickly, and some new queries would benefit from an index that nobody has created.


Automatic Indexing, added in Oracle Database 19c, takes over this work. A background task looks at the statements the application runs, identifies candidate indexes, creates them as invisible and unusable, builds and tests them against the real statements, and makes visible only those that improve performance. Indexes that are not used for a long time are dropped again. This post introduces it carefully on a production PDB: report first, implement later.



The Use Case

The order-entry application was migrated to Exadata Database Service in Oracle Database@Azure a month ago. Most screens are fast, but the support team reports a handful of slow searches, and AWR shows several statements doing full scans of large tables many times per minute. The development team cannot change the application quickly. The DBA wants the database to propose and test indexes, with a clear report, before anything changes for users.


Environment used in this runbook


  • Service: Exadata Database Service on Dedicated Infrastructure in Oracle Database@Azure

  • Database: Oracle Database 19c (19.24), PDB SALESPDB, two-node RAC

  • Application schema: SALES, about 1.4 TB, OLTP workload with daytime reports

  • Index tablespace: AUTO_IDX, created for automatic indexes only

  • Licence: according to the Licensing Information User Manual, Automatic Indexing is available on Oracle Database Enterprise Edition on Engineered Systems and the Exadata cloud services, which includes Exadata Database Service in Oracle Database@Azure; it is not available on other Enterprise Edition platforms



How Automatic Indexing Works

  • A background task runs every 15 minutes. It looks at the statements captured in the SQL tuning set that the database maintains for this purpose.

  • Candidates are created invisible. New indexes start as invisible and unusable, so the application's plans do not change while they are built.

  • Each candidate is tested. The task builds the index and compares the performance of the captured statements with and without it.

  • Only indexes that help become visible. In IMPLEMENT mode, useful indexes are made visible; in REPORT ONLY mode, they stay invisible and you only get the report.

  • Statements that get worse are protected. If a new index makes a statement slower, the database blocks that index for that statement with a SQL plan baseline.

  • Unused automatic indexes are removed. After a retention period without use, automatic indexes are dropped.



Step 1: Check the Current Configuration

Look at the automatic indexing settings in the PDB. On a database that has never used the feature, the mode is OFF.


SQL

-- Connected to SALESPDB as a DBA

COLUMN parameter_name FORMAT A34

COLUMN parameter_value FORMAT A20

SELECT parameter_name, parameter_value

FROM dba_auto_index_config

ORDER BY parameter_name;

Expected output

PARAMETER_NAME                     PARAMETER_VALUE
---------------------------------- --------------------
AUTO_INDEX_COMPRESSION             OFF
AUTO_INDEX_DEFAULT_TABLESPACE
AUTO_INDEX_MODE                    OFF
AUTO_INDEX_REPORT_RETENTION        31
AUTO_INDEX_RETENTION_FOR_AUTO      373
AUTO_INDEX_RETENTION_FOR_MANUAL
AUTO_INDEX_SCHEMA
AUTO_INDEX_SPACE_BUDGET            50

What to expect: Mode OFF and the defaults: automatic indexes that are unused for 373 days are dropped, reports are kept for 31 days, and automatic indexes may use up to 50 percent of the default tablespace. An empty AUTO_INDEX_RETENTION_FOR_MANUAL means that manually created indexes are never dropped, which is what you want at the start.



Step 2: Give Automatic Indexes Their Own Tablespace

Keep automatic indexes in a tablespace of their own, so that their space is easy to measure and limit and cannot fill the application's tablespace.


SQL

CREATE BIGFILE TABLESPACE auto_idx DATAFILE '+DATAC1' SIZE 50G AUTOEXTEND ON NEXT 10G MAXSIZE 200G;

BEGIN

DBMS_AUTO_INDEX.CONFIGURE('AUTO_INDEX_DEFAULT_TABLESPACE', 'AUTO_IDX');

END;

/

Expected output

Tablespace created.

PL/SQL procedure successfully completed.

What this does: Automatic indexes are created in AUTO_IDX, and the space budget of 50 percent now applies to that tablespace. On Exadata Database Service the data disk group is usually named +DATAC1; check the name with the asmcmd lsdg command or in V$ASM_DISKGROUP before creating the tablespace.



Step 3: Limit It to the Application Schema

By default, automatic indexing considers all schemas except the Oracle-supplied ones. Restrict it to the application schema, so that third-party tools and ad hoc schemas are left alone.


SQL

BEGIN

DBMS_AUTO_INDEX.CONFIGURE('AUTO_INDEX_SCHEMA', 'SALES', allow => TRUE);

END;

/

SELECT parameter_name, parameter_value

FROM dba_auto_index_config

WHERE parameter_name = 'AUTO_INDEX_SCHEMA';

Expected output

PL/SQL procedure successfully completed.

PARAMETER_NAME                     PARAMETER_VALUE
---------------------------------- --------------------
AUTO_INDEX_SCHEMA                  schema IN (SALES)

What this does: Only statements on SALES tables are considered. Once a schema is on the inclusion list, all other schemas are excluded. To exclude a single schema instead, call the same procedure with allow => FALSE.



Step 4: Start in Report-Only Mode

Switch automatic indexing on in REPORT ONLY mode. Candidate indexes are built and tested, but stay invisible, so no plan changes for the application.


SQL

BEGIN

DBMS_AUTO_INDEX.CONFIGURE('AUTO_INDEX_MODE', 'REPORT ONLY');

END;

/

SELECT parameter_name, parameter_value

FROM dba_auto_index_config

WHERE parameter_name = 'AUTO_INDEX_MODE';

Expected output

PL/SQL procedure successfully completed.

PARAMETER_NAME                     PARAMETER_VALUE
---------------------------------- --------------------
AUTO_INDEX_MODE                    REPORT ONLY

What to expect: The mode is REPORT ONLY. The first task runs within 15 minutes. Building candidate indexes uses CPU and I/O on the Exadata cluster even in this mode, so watch the first days and switch back to OFF if the load is noticeable during business hours.


Tip: Run report-only mode for at least a full business week, including any month-end jobs. A candidate that helps the Monday reports but hurts the Friday batch only shows up when both have run.


Step 5: Check the Task Executions

After a few hours, confirm that the background task runs and completes. Each execution is recorded with its start time and status.


SQL

COLUMN execution_name FORMAT A30

COLUMN status FORMAT A10

SELECT execution_name,

TO_CHAR(execution_start, 'YYYY-MM-DD HH24:MI') AS started,

status

FROM dba_auto_index_executions

ORDER BY execution_start DESC

FETCH FIRST 4 ROWS ONLY;

Expected output

EXECUTION_NAME                 STARTED          STATUS
------------------------------ ---------------- ----------
SYS_AI_2026-11-21/09:47:12     2026-11-21 09:47 COMPLETED
SYS_AI_2026-11-21/09:31:58     2026-11-21 09:31 COMPLETED
SYS_AI_2026-11-21/09:16:40     2026-11-21 09:16 COMPLETED
SYS_AI_2026-11-21/09:01:25     2026-11-21 09:01 COMPLETED

What to expect: One execution about every 15 minutes, each COMPLETED. An execution that keeps ending in another status points to a problem, such as a full AUTO_IDX tablespace; the activity report in the next step shows the details.



Step 6: Read the Activity Report

The activity report summarises what the task has found and tested over a period. Read it after a few days in report-only mode.


SQL

SET LONG 1000000 PAGESIZE 0 LINESIZE 120

SELECT DBMS_AUTO_INDEX.REPORT_ACTIVITY(

activity_start => SYSTIMESTAMP - INTERVAL '7' DAY,

activity_end => SYSTIMESTAMP,

type => 'TEXT',

section => 'SUMMARY',

level => 'BASIC')

FROM dual;

Expected output

GENERAL INFORMATION
-------------------------------------------------------------------------------
 Activity start               : 14-NOV-2026 20:15:02
 Activity end                 : 21-NOV-2026 20:15:02
 Executions completed         : 671
 Executions interrupted       : 0
 Executions with fatal error  : 0
-------------------------------------------------------------------------------

SUMMARY (AUTO INDEXES)
-------------------------------------------------------------------------------
 Index candidates                              : 19
 Indexes created (visible / invisible)         : 4 (0 / 4)
 Space used (visible / invisible)              : 6.84 GB (0 B / 6.84 GB)
 Indexes dropped                               : 0
 SQL statements verified                       : 52
 SQL statements improved (improvement factor)  : 31 (8.7x)
 SQL plan baselines created                    : 2
 Overall improvement factor                    : 5.2x
-------------------------------------------------------------------------------

What to expect: Out of 19 candidates, 4 indexes passed the test, all still invisible because of report-only mode. They would improve 31 statements by a factor of 8.7, and 2 SQL plan baselines protect statements that would have become slower. Use section => 'ALL' with level => 'TYPICAL' to see the index definitions and the statements behind these numbers.



Step 7: Review the Proposed Indexes

Look at the automatic indexes themselves before letting them go live. They are named SYS_AI_ followed by a generated string, and DBA_INDEXES marks them with AUTO = YES.


SQL

COLUMN index_name FORMAT A20

COLUMN table_name FORMAT A14

COLUMN columns FORMAT A26

SELECT i.index_name, i.table_name, i.visibility,

LISTAGG(c.column_name, ',') WITHIN GROUP (ORDER BY c.column_position) AS columns

FROM dba_indexes i

JOIN dba_ind_columns c

ON c.index_owner = i.owner AND c.index_name = i.index_name

WHERE i.owner = 'SALES' AND i.auto = 'YES'

GROUP BY i.index_name, i.table_name, i.visibility

ORDER BY i.table_name;

Expected output

INDEX_NAME           TABLE_NAME     VISIBILIT COLUMNS
-------------------- -------------- --------- --------------------------
SYS_AI_4r8kq2m1x9zvd CUSTOMERS      INVISIBLE EMAIL
SYS_AI_7c3wn5h0ta2fb ORDER_ITEMS    INVISIBLE PRODUCT_ID,ORDER_ID
SYS_AI_1p6yd8j4ks0me ORDERS         INVISIBLE STATUS,ORDER_DATE
SYS_AI_9g2vb7r3lq5wc SHIPMENTS      INVISIBLE TRACKING_NO

What to expect: Four indexes that make sense to a person reading the application: searches by e-mail address, by product, by order status and date, and by tracking number. Share the list with the development team. If an index looks wrong for the application, keep the schema in report-only mode a little longer and check which statements it was built for in the detailed report.



Step 8: Switch to Implement Mode

When the report has been reviewed and agreed, switch the mode to IMPLEMENT. From now on, indexes that pass the test are made visible and the optimizer uses them.


SQL

BEGIN

DBMS_AUTO_INDEX.CONFIGURE('AUTO_INDEX_MODE', 'IMPLEMENT');

END;

/

-- After the next executions, check the visibility again

SELECT index_name, visibility, status

FROM dba_indexes

WHERE owner = 'SALES' AND auto = 'YES'

ORDER BY index_name;

Expected output

PL/SQL procedure successfully completed.

INDEX_NAME           VISIBILIT STATUS
-------------------- --------- --------
SYS_AI_1p6yd8j4ks0me VISIBLE   VALID
SYS_AI_4r8kq2m1x9zvd VISIBLE   VALID
SYS_AI_7c3wn5h0ta2fb VISIBLE   VALID
SYS_AI_9g2vb7r3lq5wc VISIBLE   VALID

What to expect: The tested indexes become visible and VALID within the next executions, and the slow searches the support team reported should now use them. Compare the response times of the affected statements in AWR before and after the switch, and keep the comparison for the change record.



Step 9: Watch Space and Keep Control

Check regularly how much space automatic indexes use, and know how to stop the feature quickly if you need to.


SQL

COLUMN tablespace_name FORMAT A16

SELECT tablespace_name, COUNT(*) AS segments,

ROUND(SUM(bytes)/1024/1024/1024, 1) AS gb

FROM dba_segments

WHERE tablespace_name = 'AUTO_IDX'

GROUP BY tablespace_name;

-- To stop creating new automatic indexes at once; existing ones stay

-- EXEC DBMS_AUTO_INDEX.CONFIGURE('AUTO_INDEX_MODE', 'OFF');

Expected output

TABLESPACE_NAME    SEGMENTS         GB
---------------- ---------- ----------
AUTO_IDX                  4        6.8

What to expect: Four segments using 6.8 GB, well inside the budget. Setting the mode to OFF stops the task from creating new automatic indexes; the existing ones remain and are still used. If a single automatic index causes trouble, make it invisible with ALTER INDEX ... INVISIBLE while you investigate.



Summary

Automatic Indexing lets an Exadata database in Oracle Database@Azure find, test and maintain the indexes its workload needs. Check the configuration, give automatic indexes their own tablespace, and limit the feature to the application schema. Start in REPORT ONLY mode for at least a business week, confirm that the task executions complete, and read the activity report and the list of proposed indexes with the development team. Then switch to IMPLEMENT, compare the response times in AWR, and keep an eye on the space used. The feature is available only on Exadata platforms, including Exadata Database Service, so check the licensing manual before relying on it anywhere else.

Recent Posts

See All

Comments


bottom of page