There isn’t anything to “fix” because nothing is “broken.” Again, you are comparing the results of extremely-out-of-date-MySQL to modern-mariadb. If you want to accurately test, you need to upgrade your 5.5 to 8.0. Then, you can do a much closer comparison of "modern MySQL to “modern MariaDB”. But again, that’s mysql/maria, apples/oranges. MariaDB is not MySQL. MariaDB has made changes to the query optimizer that do not align with the rest of the community.