Monday, 11 December 2023

Invisible Index Usage

 Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. Dropping and re-adding an index can be expensive for a large table, whereas making it invisible and visible are fast, in-place operations.

ALTER TABLE t1 ALTER INDEX i_idx INVISIBLE;

ALTER TABLE t1 ALTER INDEX i_idx VISIBLE;

If you want to use invisible indexes in your optimisation, you can turn this on at the session level:
ALTER SESSION SET OPTIMIZER_USE_INVISIBLE_INDEXES = TRUE;

No comments:

Post a Comment