How does innodb_stats_on_metadata relate to query execution plan stability?
Here is something you may find surprising

Pick any large InnoDB table. Let's say the table is mydb.mytable.

Run this

SHOW INDEXES FROM mydb.mytable;


If you run this query repeatedly, you will notice that the Cardinality column changes. That happens because the InnoDB Storage Engine tries to compute (estimate) the Cardinality based on the BTREE indexes and their leaves rather than brute force counting.

Disabling innodb_stats_on_metadata makes the Cardinality stand still to compute a consistent Explain Plan.

I wrote about this before


Can SHOW TABLE STATUS query performance on MySQL be improved - Amazon RDS
Why are these queries slow in some environments and not others? Can we fix their performance?
When are InnoDB table index statistics updated?
MySQL IS NULL / IS NOT NULL Misbehaving?