Query goal: | Get overview of disk usage. |
Query type: | Sofware measure (Numeric values (software measures) about the database) |
Query license: | MIT License |
Data source: | system catalog only |
SQL query: | Click on query to copy it
WITH database_size AS (SELECT pg_database_size(current_database()) AS database_total_size), index_size AS (SELECT Sum(pg_total_relation_size(c.oid)) AS index_total_size FROM pg_class c WHERE c.relkind IN ('i','I')) SELECT pg_size_pretty(database_total_size) AS database_total_size, pg_size_pretty(index_total_size) AS index_total_size, Round(index_total_size*100/database_total_size, 1) AS percentage_of_index_size_from_total_size FROM database_size, index_size; |
Collection name | Collection description |
---|---|
Find problems by overview | Queries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not . |
Category name | Category description |
---|---|
Data at the database physical level | Queries of this category provide information about the disk usage. |