Show sizes
table, index, toast and total size per Table size of each index
This commit is contained in:
parent
d6aeef492d
commit
11459e1e12
17 changed files with 138 additions and 28 deletions
|
|
@ -50,6 +50,10 @@ public:
|
|||
QString viewdef;
|
||||
|
||||
QString description; // from pg_description
|
||||
int64_t totalBytes;
|
||||
int64_t indexBytes;
|
||||
int64_t toastBytes;
|
||||
|
||||
|
||||
using PgNamespaceObject::PgNamespaceObject;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,17 @@ std::string PgClassContainer::getLoadQuery() const
|
|||
" relowner, relam, relfilenode, reltablespace, relpages, "
|
||||
" reltuples, reltoastrelid, relisshared, relpersistence, "
|
||||
" relkind, relispopulated, relfrozenxid, relminmxid, "
|
||||
" reloptions, d.description, relacl, pg_get_viewdef(oid)";
|
||||
" reloptions, d.description, "
|
||||
" pg_total_relation_size(oid) AS total_bytes, "
|
||||
" CASE WHEN relkind='r' THEN pg_indexes_size(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(oid)";
|
||||
|
||||
if (lessThenVersion(120000))
|
||||
q += ", relhasoids ";
|
||||
|
||||
q +=
|
||||
"\nFROM pg_catalog.pg_class \n"
|
||||
"\nFROM pg_catalog.pg_class \n"
|
||||
" LEFT JOIN pg_catalog.pg_description AS d ON (objoid=pg_class.oid AND objsubid=0) \n"
|
||||
"WHERE relkind IN ('r', 'i', 'p', 'I', 'v', 'm', 'f')";
|
||||
|
||||
|
|
@ -37,7 +41,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.options >> v.description >> v.totalBytes >> v.indexBytes >> v.toastBytes;
|
||||
|
||||
|
||||
v.setOwnerOid(owner);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public:
|
|||
QString exprs;
|
||||
QString pred;
|
||||
QString definition;
|
||||
int64_t sizeBytes;
|
||||
|
||||
using PgNamespaceObject::PgNamespaceObject;
|
||||
QString getAm() const;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SELECT indexrelid, indrelid, indnatts, indisunique, indisprimary,
|
|||
indisexclusion, indimmediate, indisclustered, indisvalid,
|
||||
indcheckxmin, indisready, indislive, indkey,
|
||||
indcollation, indclass, indoption, indexprs, indpred,
|
||||
pg_get_indexdef(indexrelid))__";
|
||||
pg_get_indexdef(indexrelid), pg_total_relation_size(indexrelid))__";
|
||||
|
||||
if (minimumVersion(90400))
|
||||
q += ", indisreplident ";
|
||||
|
|
@ -35,7 +35,7 @@ PgIndex PgIndexContainer::loadElem(const Pgsql::Row &row)
|
|||
col.getAsVector<Oid>(std::back_inserter(v.collation));
|
||||
col.getAsVector<Oid>(std::back_inserter(v.indclass));
|
||||
col.getAsVector<int16_t>(std::back_inserter(v.option));
|
||||
col >> v.exprs >> v.pred >> v.definition;
|
||||
col >> v.exprs >> v.pred >> v.definition >> v.sizeBytes;
|
||||
if (minimumVersion(90400))
|
||||
col >> v.isreplident;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue