Are there any guidelines for setting innodb_stats_persistent_sample_pages in MySQL? The default value (20) seems to produce fairly accurate index cardinalities for small tables, which in turn results into good execution plans. But from what I've seen, accuracy starts falling off once your table grows.  

It sounds reasonable, at least in my mind, that the number of pages to sample should be a percentage of the total number of rows.

I tried reading the manual and also tried searching for related literature, but so far I haven't found anything.

I could always go the trial and error route, but surely I'm not the only one with this conundrum.

Thanks in advance!
It's a crap shoot.


Too high --> takes too long; and not necessarily better stats
Too low --> inaccurate stats
Percentage --> 1% is close to hitting every block (for the typical table that has about 100 rows per block).
As table grows, InnoDB allegedly re-ANALYZEs after 10% growth, so no manual action needed.
Most tables have decent stats from 20.
Tables with uneven distribution won't benefit from changing the '20', at least not until some decent "histogram" stats are implemented.  Then, Optimization becomes much more complex, and potentially slower.


Bottom line:  Leave it at 20.  Keep the slowlog on.  Tackle the worst entry in the slowlog, with an eye for solutions that don't depend on the '20'.