Number of records in MySQL database
Well, that should be enough to get the count of all records in the current database:
SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = DATABASE();
Surprisingly, I get different numbers every time I execute the above expression! At first I thought there was a problem with my database. But this is the same for the sample db provided by the MySQL developers.
Executing the above statement sakila
multiple times results in the following values:
46362 48104 45170 47060 48139
What am I doing wrong? This is mistake?
+3
source to share