While working with MySQL databases, it is often required to find out the total number of rows in some table.
There are many different ways to count the table rows in MySQL, but as the performance always matters, the fastest way is the most preferable.
Below you will find the best and the fastest way to get the number of rows in a table using the simple SQL query.
Cool Tip: How large your table is? Check its size with a single query! Read more →
Count Table Rows In MySQL
SELECT COUNT(*) command against a table to calculate the total number of rows:
mysql> SELECT COUNT(*) FROM `table_name`;
+----------+ | COUNT(*) | +----------+ | 57441808 | +----------+ 1 row in set (1 min 16.66 sec)