If you know SQL you could create an SQL sensor to query the statistics table of the database.
This one is for MariaDB: