Thanks Eamon... I will think about it... But I'm looking at almost 1,000,000 rows.
Not sure this is the most effecient way. But I do appreciate the effort!


I think the idea of a php script that loops through "show tables" to get the table names and then does a "Select COUNT(*)" on each one and sums it up would probably be more effecient.

Cheers,
Mike




Eamon Daly wrote:

Well, here's a quick and dirty way to do it:

   #!/bin/sh

   mkdir /tmp/count
   chmod a+rwx /tmp/count
   cd /tmp/count

   mysqldump -T . production
   wc -l *.txt > production
   rm *.sql *.txt

   mysqldump -T . standby
   wc -l *.txt > standby

   diff production standby

   rm -rf /tmp/count

Creates output like so:

20,21c20,21
<       3 users.txt
<     952 total
---

      6 users.txt
    955 total


____________________________________________________________
Eamon Daly



----- Original Message ----- From: "Michael J. Pawlowsky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 14, 2004 5:54 AM
Subject: Number of Rows in DB.



Does anyone know of a quick way to get the number of rows in a database from the command prompt.

I run a cron job that does a mysql dump nightly from a prod server piped to a standy server.
It's a 2 line shell script including outputting the date at time.


After the dump, I would like to output the number of rows in the prod database and the newly updated standby database to make sure these match. The output is e-mailed to me, so in the morning I could simply see if they match and be assured that the dump went well.

Thanks,
Mike




-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to