MySQL
MySQL runs a large share of the web, and interviews probe it as an engine: InnoDB and its clustered index, gap locks, binlog replication and server tuning.
on this pageshowhide
explore
- Types & Online DDL6 questions
- InnoDB & Storage Engines6 questions
- Index Types & EXPLAIN6 questions
- InnoDB Locking & Isolation6 questions
- Binlog Replication6 questions
- Query & Server Tuning6 questions
questions
page 2 of 2For a MySQL 8.4 OLTP database that must survive losing its primary, how do you choose between async GTID replicas, semisynchronous replication and an InnoDB Cluster?
basics
~20 sChoose by tolerated data loss, recovery time, network latency and operating skill. Async GTID replicas are simplest but can lose commits; semisync AFTER_SYNC narrows loss at commit latency; InnoDB Cluster adds consensus and automatic failover with stricter requirements.
As the lead for a MySQL fleet, how do you decide whether a large-table change runs as native online DDL, through gh-ost or through pt-online-schema-change?
basics
~20 sUse MySQL's native INSTANT DDL whenever the change allows it; for changes that rebuild or copy a large hot table, use gh-ost, which reads the binlog and can be throttled, or pt-online-schema-change, which uses triggers but handles foreign keys.
Should a team switch MySQL's transaction_isolation from InnoDB's default REPEATABLE-READ to READ-COMMITTED fleet-wide, and what does that trade in locking and correctness?
basics
~20 sSometimes: READ COMMITTED drops InnoDB's gap locking for searches and releases locks on non-matching rows, cutting lock waits and gap-related deadlocks, but it takes a fresh snapshot per statement and stops protecting range checks against concurrent inserts.
In MySQL Group Replication, how does certification decide whether a transaction commits, and why is single-primary mode the default?
basics
~20 sIn MySQL Group Replication, a committing transaction broadcasts its changed rows and writeset; all members receive it in one agreed order, and certification rolls it back if an earlier concurrent transaction changed the same row. Single-primary mode avoids those conflicts.
In MySQL, before dropping a suspected-unused secondary index on a large table, how would you test the drop with an invisible index, and what does invisibility leave unchanged?
basics
~20 sRun ALTER TABLE ... ALTER INDEX idx INVISIBLE, watch plans, the slow query log and Performance Schema, then drop it or make it VISIBLE again instantly. An invisible index is still maintained on writes and still enforces uniqueness.
In MySQL 8.4, the optimizer misjudges a skewed, non-indexed column and picks a bad join order; when do you add a histogram, and when an optimizer hint?
basics
~20 sAdd a histogram (ANALYZE TABLE ... UPDATE HISTOGRAM) when a non-indexed column's row estimate is wrong; it fixes every query filtering on it. Use a /*+ ... */ optimizer hint only to pin one statement's plan that better statistics cannot fix.
showing 31–36 of 36