Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/src/org/labkey/core/CoreModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,11 @@ public void moduleStartupComplete(ServletContext servletContext)

if (CoreSchema.getInstance().getSqlDialect().isPostgreSQL())
{
// Exclude temp schema to avoid PG exceptions when tables are appearing/disappearing during execution
// Note that they can be non-trivial in size.
SQLFragment sql = new SQLFragment("SELECT table_schema, SUM(total_size) FROM ");
sql.append(new PostgresTableSizesTable(new PostgresUserSchema(User.getAdminServiceUser(), ContainerManager.getRoot())), "t");
sql.append(" GROUP BY table_schema");
sql.append(" WHERE table_schema != 'temp' GROUP BY table_schema");

var schemaSizes = new SqlSelector(CoreSchema.getInstance().getSchema(), sql).getValueMap();
results.put("databaseSchemaSize", schemaSizes);
Expand Down