count rows in mysqldump

Get rough estimate of rows from multiple mysqldump files from a single table split into multiple sections:

# cat table1.*.sql |sed -e 's/),(/\n/g' | wc -l
4699008

Here’s from the actual table:

mysql> select count(id) from table;
+-----------+
| count(id) |
+-----------+
|   4692064 |
+-----------+
1 row in set (0.00 sec)

Counting the inserts in the mysqldump is a good rough estimate. In this case it’s off by about .1%, because of pattern interpretation or shift in database between dump and the count.

share:

Leave a Reply

Your email address will not be published. Required fields are marked *