Search code examples
databaseh2

H2 database tables size


how can I check the size of all my tables in MB for my h2 database?I have tried queries that check that for other databases but they don't seem to work,so I am wondering if there is a way to check that.


Solution

  • There is the DISK_SPACE_USED function for H2 that gives you the size of the passed in table as a string parameter. You have to be on a later version of the H2 jar though I know it needs to be later than version 1.3.170, the change log shows changes were made to the function in 1.4.198 not sure what version the function was introduced in though.

    Here is a link to the function:

    http://www.h2database.com/html/functions.html#disk_space_used