Retrieve tables sizes asynchronously when opening the catalog.

This commit is contained in:
eelke 2022-01-17 17:12:07 +01:00
parent 8fe5e05f7d
commit 39195153cd
8 changed files with 163 additions and 52 deletions

View file

@ -50,10 +50,6 @@ public:
QString viewdef;
QString description; // from pg_description
int64_t totalBytes;
int64_t indexBytes;
int64_t toastBytes;
using PgNamespaceObject::PgNamespaceObject;

View file

@ -12,9 +12,6 @@ std::string PgClassContainer::getLoadQuery() const
" reltuples, reltoastrelid, relisshared, relpersistence, "
" relkind, relispopulated, relfrozenxid, relminmxid, "
" reloptions, d.description, "
" pg_total_relation_size(pg_class.oid) AS total_bytes, "
" CASE WHEN relkind='r' THEN pg_indexes_size(pg_class.oid) ELSE 0 END AS index_bytes, "
" CASE WHEN relkind='r' THEN pg_total_relation_size(reltoastrelid) ELSE 0 END AS toast_bytes, "
" relacl, pg_get_viewdef(pg_class.oid)";
if (lessThenVersion(120000))
@ -41,8 +38,7 @@ PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
>> owner >> v.am >> v.filenode >> v.tablespace >> v.pages_est
>> v.tuples_est >> v.toastrelid >> v.isshared >> v.persistence
>> v.kind >> v.ispopulated >> v.frozenxid >> v.minmxid
>> v.options >> v.description >> v.totalBytes >> v.indexBytes >> v.toastBytes;
>> v.options >> v.description;
v.setOwnerOid(owner);