For some time now, I am seeing performance problems with large tables in MySQL (vanilla and Percona) that in MariaDB do not occur, and it is not that it is happening.
For example, I have this simple query, running on a Percona 8.0.31 and a MariaDB 10.6.12:
select * from LOG where IDADMIN != 99999 order by FECHA desc limit 10 offset 0;
MySQL Percona Execution time: 10 rows in set (2.94 sec)
MariaDB Execution time: 10 rows in set (0.334 sec)
The indexes and cardinality are the same, and an explain is equivalent to:
Attached is the output of the optimizer, in mariaDB the information it offers is less, but curiously I don’t see anything about sort, which seems to be what spends all the time on execution.
It’s unfortunate that MariaDB doesn’t have EXPLAIN ANALYZE. Anyways, have you verified the result set is exactly the same between them?
Example:
mysql> pager md5
mysql> SELECT ....
The output will be an md5 hash. Run this on both and compare the hashes. Are they the same? I’m asking this because in looking at the optimizer traces, I don’t see MariaDB doing the ORDER BY DESC. The Community/Percona trace is almost 100 lines longer than MariaDB’s trace, containing information on the ORDER BY part of the execution.
If MariaDB isn’t doing that part, then that would explain the faster execution.
As another series of tests, I suggest first dropping the ‘limit 10 offset 0’, and then the next series dropping the ‘order by’.
Percona spent most of the time in sorting, mariaDB don’t sort at all.
This is a lot of time to sort such tiny table…
I would
Rebuilt table in percona and in mariaDb and rerun the same test.
Check the OS side (at least some sar statistics
Check memory configurations on both servers.
In my opinion such sort should be done in memory, do we have any CPU starvation on percona server? (logcal/memory reads/writes mostly consuming CPU usually)
Since execution plan is a trivial full table scan there is nothing to check on optimizer level.
To do an FTS database need to read all pages from disk, apply filter , return the result set.