- Sagar T

Invisible Index
 An invisible index is an index that is maintained by the

database but ignored by the optimizer unless explicitly specified.  The invisible index is an alternative to dropping or making an index unusable. (Unlike unusable indexes, invisible indexes behave the same like a normal index towards the DML operations. They need to be updated with each DML operation. No advantage of making an index invisible during bulk load inserts)

Need of Invisible Indexes
 In testing scenarios, one may need to tune queries, check the effectiveness of optimizer behavior based on indexes on tables. This will require dropping and recreating indexes numerous times.

Solution – Use invisible indexes and instead of dropping the index, make it invisible rather than dropping and recreating as recreation of an index is very expensive and requires a lot of database resources and consumes time.
 In production scenarios , having an index may improve the performance of a single query, while it can degrade the performance of other queries.

Solution- Using Invisible indexes, its possible to have infrequent queries refer indexes while remaining invisible for other queries.
 The optimizer cannot guarantee the best suitable index required for the query in an environment which is cluttered by too many indexes on a table.

Solution – Use invisible indexes to make the optimizer ignore the indexes degrading the performance of the query.

How to use INVISIBLE INDEXES ?
CREATE INDEX [INDEX NAME] ON [TABLE NAME (COLUMN NAME)] INVISIBLE;

Advantages

Invisible indexes can help to a great extent, in testing scenarios where the optimizer behaviour needs to be tested without the index. This does not need dropping and recreating the index.  Indexes can be created for certain adhoc queries (queries that are fired very infrequently) and can be made invisible after the usage.

Thank You!

Sign up to vote on this title
UsefulNot useful