If you need to find the fastest way to count the number of rows in a massive MariaDB, or MySQL table, then you can do the following instead of performing a select count() query:

show table status like '<TABLE_NAME>'

This will provide you with a table of information about the table statistics, including the amount of rows.