Thread: Database size??

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    12
    Rep Power
    0
    What's the easiest way to find the total size for a database?

    Thanks
    MarkO
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    15
    If you want to know the size in bytes (or kbytes, mbytes etc.) do something along the lines of:
    du /usr/local/mysql/data
    (where /usr/local/mysql/data is the path to your data files for the database).

    If you want to know how many rows are in a table, do:
    select count(*) from table;

    If you want to know how many tables there are, type show tables; and count the number of results (or run it through some application logic to do that for you). This is one of my gripes with MySQL - it treats meta data about certain things (tables, databases in particular) differently to the rest of the information in the DB. I much prefer the Oracle approach of storing all that info in relational tables so all your standard SQL commands work on it.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Amsterdam
    Posts
    1
    Rep Power
    0
    I know that in sybase you can check it with sp_helpdevice don't know if that works in mysql
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    12
    Rep Power
    0
    Using du -h /usr/local/mysql/data/dbname gave me the exact info I was looking for.

    Thanks
    MarkO

Similar Threads

  1. maysqladmin drop database syntax?
    By Slurm in forum MySQL Help
    Replies: 1
    Last Post: February 17th, 2004, 05:07 AM
  2. Need advice designing a usage tracking database (MySQL)
    By Randolpho in forum Database Management
    Replies: 0
    Last Post: February 13th, 2004, 04:11 PM
  3. 2-dimensial array / mysql_fetch_array database problem
    By paulx82 in forum PHP Development
    Replies: 3
    Last Post: December 27th, 2003, 01:52 AM
  4. creating database & tables using ASP
    By pdxlooie in forum ASP Programming
    Replies: 2
    Last Post: December 26th, 2003, 05:27 PM
  5. distributing database reads among db slaves
    By JunkCookie in forum PHP Development
    Replies: 3
    Last Post: December 17th, 2003, 11:45 AM

IMN logo majestic logo threadwatch logo seochat tools logo