Lesson 74/100

Tutorials MySQL Tutorial

Invisible Indexes — Complete Guide

Invisible Indexes — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of MySQL Tutorial on Toolliyo Academy.

On this page

MySQL Tutorial · Lesson 74 of 100

Invisible Indexes

Basics ✓Advanced

Advanced · 2 — Production · ~10 min · MySQL — Advanced MySQL

What is this?

Invisible indexes exist for optimizer statistics and testing but are ignored by planner unless session use_invisible_indexes=ON. Lets you test drop impact safely.

Why should you care?

Drop wrong index on orders — production slows overnight. Make invisible first, watch slow log, then drop.

See it live — copy this example

Run in MySQL Workbench or the mysql CLI.

ALTER TABLE orders ALTER INDEX idx_orders_customer INVISIBLE;
EXPLAIN SELECT * FROM orders WHERE customer_id = 5;
-- Plan may skip idx_orders_customer
ALTER TABLE orders ALTER INDEX idx_orders_customer VISIBLE;

What happened?

  • INVISIBLE hides index from default plans.
  • If queries slow, index was still needed — make VISIBLE again.
  • Safer than DROP in prod experimentation.

Practice next

  1. CREATE or pick existing secondary index.
  2. ALTER INDEX INVISIBLE.
  3. EXPLAIN key queries — note plan change.
  4. SET SESSION use_invisible_indexes = ON to force use for experiments.
  5. Query performance_schema for index usage stats.

Remember

Test index removal without DROP. Toggle VISIBLE/INVISIBLE quickly. Monitor slow log during invisible window.

DataFlow index retirement

DBA makes legacy idx invisible during sale week — no regressions → drop later.

Outcome: Write throughput gains without read surprise.

Interview prep for this lesson

Practice these questions aloud after reading—each links to a full structured answer.

Junior Detailed
Explain SQL queries in the context of MySQL.
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define SQL queri…
Mid Detailed
What are common mistakes teams make with Schema design when using MySQL?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define Schema de…
Senior Detailed
How would you debug a production issue related to Transactions in a MySQL application?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define Transacti…
Junior Detailed
Describe a real-world scenario where Normalization mattered in a MySQL project.
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define Normaliza…
Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

MySQL Tutorial
Course syllabus

MySQL Tutorial

MySQL — Foundations
MySQL — Queries & Clauses
MySQL — Joins & Relationships
MySQL — Functions & Window Functions
MySQL — Transactions & Concurrency
MySQL — Stored Procedures & Triggers
MySQL — Indexing & Performance
MySQL — Advanced MySQL
MySQL — Security & Cloud MySQL
MySQL — Real-World Projects
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details