We upgrade MariaDB version from 10.3 to 10.5. Some explain plans change for worst plans. We see that documentation https://mariadb.com/kb/en/engine-independent-table-statistics/ and we see that
use_stat_tables='preferably_for_queries'
is default configuration but we have empty tables for engine independent stats so I expected that it use innodb stats but if change it to never or complementary_for_queries I get another (usually better) execution plan. So I was very surprised of that.
Next if I want use engine independent stats I need to process some (or all) tables stats with ANALYZE TABLE tbl PERSISTENT FOR ALL;
But it's freeze database, so I understand that I can use a slave generate and copy them (not very friendly with varbinary and blob columns).
And finally I don't know how explain plan will become.
I fact I did it and that's not give me better explain plan (same plan with empty stats tables) with use_stat_tables='preferably_for_queries' option and I did flush table
.
So I'm block with use_stat_tables='never' so do I need user independent engine stats ? How to do that ?
Update: With engine independent stats tables empty why a get different explain plans when a switch from use_stat_tables='never' to use_stat_tables='preferably_for_queries' ? Is it a bug ?