Testing indexes
How to test indexes in MySQL without permanently applying them.
Profiling
Temporary indexes
-- source: https://www.mysqltutorial.org/mysql-transaction.aspx/
-- 1. disable automatic COMMITs within transactions
SET autocommit = 0;
-- 2. start a new transaction
START TRANSACTION;
-- EXPLAIN
EXPLAIN SELECT *; -- your query
-- 3. add index
ALTER TABLE foo ADD INDEX index_name (a,b,c);
-- EXPLAIN again to see improvements
EXPLAIN SELECT *; -- your query
-- 4. Reset your changes
ROLLBACK;Avoiding caching
Tricks
Notes
Last updated