Skip to main content
WolfShade
Legend
March 27, 2017
Question

Get size of database?

  • March 27, 2017
  • 1 reply
  • 918 views

Hello, all,

I know that CF has CFDBINFO, but it doesn't return the information I am looking for.

The hosting service that I am using for a personal project (hostek.com) puts a limit of 250M on their databases; but you can have an unlimited number of databases.

I would like to check the size of a database before uploading files to it.  Basically, if the database is at or near the 250M limit, I want to export some data to an archive table, then finish the upload into the original table.

Is this possible in CF??

V/r,

^_^

    This topic has been closed for replies.

    1 reply

    Dave Ferguson
    Participating Frequently
    March 27, 2017

    If you are on SQL server you can run a system stored proc of  "sp_helpdb" to get size.

    HTH,

    --Dave

    WolfShade
    WolfShadeAuthor
    Legend
    March 27, 2017

    I should have mentioned that it's a MySQL db.  You can't see it, but I'm facepalming myself for not having included that important bit of information in my original post.  (Hangs head in shame.)

    Thankfully, I'm too shallow to be depressed for too long. 

    Heheheh.. it's a MySQL, I forget which version (I'm not at home, right now).  But I do have a Windows 7 VM that has the MySQL WorkBench GUI, if that helps.

    V/r,

    ^_^

    Dave Ferguson
    Participating Frequently
    March 27, 2017

    For MySQL:

    SELECT table_schema  "DB Name",
      Round
    (Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
    FROM  information_schema.tables
    GROUP  BY table_schema;

    hth,

    --Dave