Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3308702
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:33:10+00:00 2026-05-17T21:33:10+00:00

I downloaded a VM image of a web application that uses MySQL. How can

  • 0

I downloaded a VM image of a web application that uses MySQL.

How can I monitor its space consumption and know when additional space must be added?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:33:10+00:00Added an answer on May 17, 2026 at 9:33 pm

    I have some great big queries to share:

    Run this to get the Total MySQL Data and Index Usage By Storage Engine

    SELECT IFNULL(B.engine,'Total') "Storage Engine",
    CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", CONCAT(LPAD(REPLACE(
    FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') "Index Size", CONCAT(LPAD(REPLACE(
    FORMAT(B.TSize/POWER(1024,pw),3),',',''),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') "Table Size" FROM
    (SELECT engine,SUM(data_length) DSize,SUM(index_length) ISize,
    SUM(data_length+index_length) TSize FROM
    information_schema.tables WHERE table_schema NOT IN
    ('mysql','information_schema','performance_schema') AND
    engine IS NOT NULL GROUP BY engine WITH ROLLUP) B,
    (SELECT 3 pw) A ORDER BY TSize;
    

    Run this to get the Total MySQL Data and Index Usage By Database

    SELECT DBName,CONCAT(LPAD(FORMAT(SDSize/POWER(1024,pw),3),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') "Data Size",CONCAT(LPAD(
    FORMAT(SXSize/POWER(1024,pw),3),17,' '),' ',SUBSTR(' KMGTP',pw+1,1),'B') "Index Size",
    CONCAT(LPAD(FORMAT(STSize/POWER(1024,pw),3),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') "Total Size" FROM
    (SELECT IFNULL(DB,'All Databases') DBName,SUM(DSize) SDSize,SUM(XSize) SXSize,
    SUM(TSize) STSize FROM (SELECT table_schema DB,data_length DSize,
    index_length XSize,data_length+index_length TSize FROM information_schema.tables
    WHERE table_schema NOT IN ('mysql','information_schema','performance_schema')) AAA
    GROUP BY DB WITH ROLLUP) AA,(SELECT 3 pw) BB ORDER BY (SDSize+SXSize);
    

    Run this to get the Total MySQL Data and Index Usage By Database and Storage Engine

    SELECT Statistic,DataSize "Data Size",IndexSize "Index Size",TableSize "Table Size"
    FROM (SELECT IF(ISNULL(table_schema)=1,10,0) schema_score,
    IF(ISNULL(engine)=1,10,0) engine_score,
    IF(ISNULL(table_schema)=1,'ZZZZZZZZZZZZZZZZ',table_schema) schemaname,
    IF(ISNULL(B.table_schema)+ISNULL(B.engine)=2,"Storage for All Databases",
    IF(ISNULL(B.table_schema)+ISNULL(B.engine)=1,
    CONCAT("Storage for ",B.table_schema),
    CONCAT(B.engine," Tables for ",B.table_schema))) Statistic,
    CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') DataSize,CONCAT(LPAD(REPLACE(
    FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') IndexSize,
    CONCAT(LPAD(REPLACE(FORMAT(B.TSize/POWER(1024,pw),3),',',''),17,' '),' ',
    SUBSTR(' KMGTP',pw+1,1),'B') TableSize FROM (SELECT table_schema,engine,
    SUM(data_length) DSize,SUM(index_length) ISize,
    SUM(data_length+index_length) TSize FROM information_schema.tables
    WHERE table_schema NOT IN ('mysql','information_schema','performance_schema')
    AND engine IS NOT NULL GROUP BY table_schema,engine WITH ROLLUP) B,
    (SELECT 3 pw) A) AA ORDER BY schemaname,schema_score,engine_score;
    

    CAVEAT

    In each query, you will see (SELECT 3 pw). The pw stands for the Power Of 1024 to display the results.

    • (SELECT 0 pw) will Display the Report in Bytes
    • (SELECT 1 pw) will Display the Report in KiloBytes
    • (SELECT 2 pw) will Display the Report in MegaBytes
    • (SELECT 3 pw) will Display the Report in GigaBytes
    • (SELECT 4 pw) will Display the Report in TeraBytes
    • (SELECT 5 pw) will Display the Report in PetaBytes (please contact me if you run this one)

    Here is a report query with a little less formatting:

    SELECT IFNULL(db,'Total') "Database",
    datsum / power(1024,pw) "Data Size",
    ndxsum / power(1024,pw) "Index Size",
    totsum / power(1024,pw) "Total"
    FROM (SELECT db,SUM(dat) datsum,SUM(ndx) ndxsum,SUM(dat+ndx) totsum
    FROM (SELECT table_schema db,data_length dat,index_length ndx
    FROM information_schema.tables WHERE engine IS NOT NULL
    AND table_schema NOT IN ('information_schema','mysql')) AA
    GROUP BY db WITH ROLLUP) A,(SELECT 1 pw) B;
    

    Trust me, I made these queries over 4 years ago and still use them today.

    UPDATE 2013-06-24 15:53 EDT

    I have something new. I have changed the queries so that you do not have to set the pw parameter for different unit displays. Each unit display is calculated for you.

    Report By Storage Engine

    SELECT
        IFNULL(ENGINE,'Total') "Storage Engine",
        LPAD(CONCAT(FORMAT(DAT/POWER(1024,pw1),2),' ',
        SUBSTR(units,pw1*2+1,2)),17,' ') "Data Size",
        LPAD(CONCAT(FORMAT(NDX/POWER(1024,pw2),2),' ',
        SUBSTR(units,pw2*2+1,2)),17,' ') "Index Size",
        LPAD(CONCAT(FORMAT(TBL/POWER(1024,pw3),2),' ',
        SUBSTR(units,pw3*2+1,2)),17,' ') "Total Size"
    FROM
    (
        SELECT ENGINE,DAT,NDX,TBL,
        IF(px>4,4,px) pw1,IF(py>4,4,py) pw2,IF(pz>4,4,pz) pw3
        FROM 
        (SELECT *,
            FLOOR(LOG(IF(DAT=0,1,DAT))/LOG(1024)) px,
            FLOOR(LOG(IF(NDX=0,1,NDX))/LOG(1024)) py,
            FLOOR(LOG(IF(TBL=0,1,TBL))/LOG(1024)) pz
            FROM
            (SELECT
                ENGINE,
                SUM(data_length) DAT,
                SUM(index_length) NDX,
                SUM(data_length+index_length) TBL
            FROM
            (
               SELECT engine,data_length,index_length FROM
               information_schema.tables WHERE table_schema NOT IN
               ('information_schema','performance_schema','mysql')
               AND ENGINE IS NOT NULL
            ) AAA GROUP BY ENGINE WITH ROLLUP
    ) AAA ) AA) A,(SELECT ' BKBMBGBTB' units) B;
    

    Report By Database

    SELECT
        IFNULL(DB,'Total') "Database",
        LPAD(CONCAT(FORMAT(DAT/POWER(1024,pw1),2),' ',
        SUBSTR(units,pw1*2+1,2)),17,' ') "Data Size",
        LPAD(CONCAT(FORMAT(NDX/POWER(1024,pw2),2),' ',
        SUBSTR(units,pw2*2+1,2)),17,' ') "Index Size",
        LPAD(CONCAT(FORMAT(TBL/POWER(1024,pw3),2),' ',
        SUBSTR(units,pw3*2+1,2)),17,' ') "Total Size"
    FROM
    (
        SELECT DB,DAT,NDX,TBL,
        IF(px>4,4,px) pw1,IF(py>4,4,py) pw2,IF(pz>4,4,pz) pw3
        FROM 
        (SELECT *,
            FLOOR(LOG(IF(DAT=0,1,DAT))/LOG(1024)) px,
            FLOOR(LOG(IF(NDX=0,1,NDX))/LOG(1024)) py,
            FLOOR(LOG(IF(TBL=0,1,TBL))/LOG(1024)) pz
        FROM
        (SELECT
            DB,
            SUM(data_length) DAT,
            SUM(index_length) NDX,
            SUM(data_length+index_length) TBL
        FROM
        (
           SELECT table_schema DB,data_length,index_length FROM
           information_schema.tables WHERE table_schema NOT IN
           ('information_schema','performance_schema','mysql')
           AND ENGINE IS NOT NULL
        ) AAA GROUP BY DB WITH ROLLUP
    ) AAA) AA) A,(SELECT ' BKBMBGBTB' units) B;
    

    Report By Database / Storage Engine

    SELECT
        IF(ISNULL(DB)+ISNULL(ENGINE)=2,'Database Total',
        CONCAT(DB,' ',IFNULL(ENGINE,'Total'))) "Reported Statistic",
        LPAD(CONCAT(FORMAT(DAT/POWER(1024,pw1),2),' ',
        SUBSTR(units,pw1*2+1,2)),17,' ') "Data Size",
        LPAD(CONCAT(FORMAT(NDX/POWER(1024,pw2),2),' ',
        SUBSTR(units,pw2*2+1,2)),17,' ') "Index Size",
        LPAD(CONCAT(FORMAT(TBL/POWER(1024,pw3),2),' ',
        SUBSTR(units,pw3*2+1,2)),17,' ') "Total Size"
    FROM
    (
        SELECT DB,ENGINE,DAT,NDX,TBL,
        IF(px>4,4,px) pw1,IF(py>4,4,py) pw2,IF(pz>4,4,pz) pw3
        FROM 
        (SELECT *,
            FLOOR(LOG(IF(DAT=0,1,DAT))/LOG(1024)) px,
            FLOOR(LOG(IF(NDX=0,1,NDX))/LOG(1024)) py,
            FLOOR(LOG(IF(TBL=0,1,TBL))/LOG(1024)) pz
        FROM
        (SELECT
            DB,ENGINE,
            SUM(data_length) DAT,
            SUM(index_length) NDX,
            SUM(data_length+index_length) TBL
        FROM
        (
           SELECT table_schema DB,ENGINE,data_length,index_length FROM
           information_schema.tables WHERE table_schema NOT IN
           ('information_schema','performance_schema','mysql')
           AND ENGINE IS NOT NULL
        ) AAA GROUP BY DB,ENGINE WITH ROLLUP
    ) AAA) AA) A,(SELECT ' BKBMBGBTB' units) B;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web application that uses JQuery AJAX and PHP to upload
I have an application that uses images from web a a source. for my
I'm working on a web application that has a lot to download (javascript, images,
I'm attempting to display a listview that includes an image previously downloaded from the
I would like to integrate jQuery-DatePicker in my web application. I downloaded the scrips,
Basicly I'm making an image gallery that downloads from the web. So - when
I'm writing a web application in PHP which needs to store images and image
I'm programming web application that works with Google Maps and I need to generate
We have created a web application, using ASP.NET, that allows users to upload documents
We have a java web application. The application generates a big image with company

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.