Skip to content
Advertisement

H2 Get row count for all tables

I would like to know the total number of rows for each table. And that for all tables at once. Is this possible with H2?

I’m thinking of a table:

|table name | row size |

At the moment I’m using the current version 1.3.170 (2012-11-30).

Advertisement

Answer

You would need to use a user-defined function, for example:

This code doesn’t take into account the schema, and only works for unquoted table names.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement