lazy load the database sizes only when needed by the server inspector.

This commit is contained in:
eelke 2022-01-19 19:10:05 +01:00
parent 39195153cd
commit b5a706a2a2
10 changed files with 165 additions and 70 deletions

View file

@ -17,7 +17,6 @@ public:
bool allowConn;
int connLimit;
Oid tablespace;
int64_t sizeBytes;
QString description;
using PgServerObject::PgServerObject;

View file

@ -6,7 +6,6 @@ std::string PgDatabaseContainer::getLoadQuery() const
return
"SELECT pg_database.oid, datname, datdba, encoding, pg_encoding_to_char(encoding), datcollate,\n"
" datctype, datistemplate, datallowconn, datconnlimit, dattablespace, \n"
" case when has_database_privilege(current_role, pg_database.oid, 'connect') then pg_database_size(pg_database.oid) else -1 end,\n"
" d.description, datacl\n"
"FROM pg_database\n"
" LEFT JOIN pg_catalog.pg_shdescription AS d ON (objoid=pg_database.oid)";
@ -20,7 +19,7 @@ PgDatabase PgDatabaseContainer::loadElem(const Pgsql::Row &row)
QString name = col.nextValue();
PgDatabase v(m_catalog, oid, name);
col >> v.dba >> v.encoding >> v.encodingString >> v.collate >> v.ctype >> v.isTemplate
>> v.allowConn >> v.connLimit >> v.tablespace >> v.sizeBytes >> v.description;
>> v.allowConn >> v.connLimit >> v.tablespace >> v.description;
AclList acl_list;
col >> acl_list;

View file

@ -13,7 +13,6 @@ namespace Pgsql {
class PgDatabaseContainer: public PgContainer<PgDatabase> {
public:
//explicit PgDatabaseContainer(PgDatabaseCatalog *cat);
using PgContainer<PgDatabase>::PgContainer;
virtual std::string getLoadQuery() const override;