How to check how much size (mb) the hasura postgres database is taking up? #6479
-
Any way we can check how much storage our current database is taking up? How would I do this both locally (Docker) and in production? Is there some |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't believe there's a Hasura-specific way to get DB size - you can pretty easily get those from queries though (either through your terminal or through the SQL tab in Hasura). SELECT pg_size_pretty(pg_database_size(current_database())); would get you your total DB size of your current DB. If you're looking for Hasura-specific storage, everything Hasura needs is stored in the To check their specific storage usage, you can use the following queries: SELECT pg_size_pretty(sum(pg_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename)))::bigint)
FROM pg_tables
WHERE schemaname = 'hdb_catalog' SELECT pg_size_pretty(sum(pg_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename)))::bigint)
FROM pg_tables
WHERE schemaname = 'hdb_views' The only place where storage becomes an issue is usually if there are a lot of event logs - there's a guide here on how to truncate those as well: https://hasura.io/docs/1.0/graphql/core/event-triggers/clean-up.html |
Beta Was this translation helpful? Give feedback.
I don't believe there's a Hasura-specific way to get DB size - you can pretty easily get those from queries though (either through your terminal or through the SQL tab in Hasura).
SELECT pg_size_pretty(pg_database_size(current_database()));
would get you your total DB size of your current DB.
If you're looking for Hasura-specific storage, everything Hasura needs is stored in the
hdb_catalog
andhdb_views
schemas.To check their specific storage usage, you can use the following queries: