Web Hosting Talk







View Full Version : Query For Database size


AudiBoy
04-15-2002, 01:29 AM
Hello Everyone..

Is there a quick way to query MySQL for a particular database's size? I noticed the PhpMyAdmin shows the size of each table, and then a total for the database.. I dug inside the code a bit, but didn't see anything that popped out at me on how to do this..

Any help would be appricated

Thanks

Jay.

Dave114
04-15-2002, 05:56 AM
One thing that has from time to time puzzled me is how hosts limit database space. I understand about filesystem quotas and whatnot, but aren't the database files owned by the uid that the database server runs on? I've never noticed anything in the mysql manual (the portions of it I've read) how to limit the size of a database. I'd assume that the host wouldn't simply use a cron script for this purpose, but what would they use?

spock
04-15-2002, 11:49 AM
You can find out table sizes with a SHOW TABLE STATUS (http://www.mysql.com/doc/S/H/SHOW_TABLE_STATUS.html) query. Another way is to keep track of the actual database files on disk, which is also how you'll usually limit the size - these files only need to be accessible to (not necessarily owned by) the database user.

AudiBoy
04-15-2002, 03:11 PM
Thanks for your replys,

I'll check out the database status method..

My one goal with the monitoring the size of the databases, is to make the information available in our control panel (both user and admin).. Since our control panel is centeralized to one server, using standard file monitoring methods are often extremely slow, and not always secure across the network...

Thanks

Jay.