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
|
|
@ -132,7 +132,11 @@ QVariant TablesTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
case OptionsCol: return tr("Options");
|
||||
case AclCol: return tr("ACL");
|
||||
case CommentCol: return tr("Comment");
|
||||
}
|
||||
case TotalSize: return tr("Total size");
|
||||
case TableSize: return tr("Table size");
|
||||
case IndexSize: return tr("Index size");
|
||||
case ToastSize: return tr("TOAST size");
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
|
|
@ -153,6 +157,12 @@ Oid TablesTableModel::getType(int column) const
|
|||
{
|
||||
Oid oid;
|
||||
switch (column) {
|
||||
case TotalSize:
|
||||
case TableSize:
|
||||
case IndexSize:
|
||||
case ToastSize:
|
||||
oid = Pgsql::int8_oid;
|
||||
break;
|
||||
case TablespaceCol:
|
||||
case OwnerCol:
|
||||
case NameCol:
|
||||
|
|
@ -179,7 +189,11 @@ QVariant TablesTableModel::getData(const QModelIndex &index) const
|
|||
case OptionsCol: break;
|
||||
case AclCol: return t.aclString();
|
||||
case CommentCol: return t.description;
|
||||
}
|
||||
case TotalSize: return t.totalBytes;
|
||||
case TableSize: return t.totalBytes - t.indexBytes - t.toastBytes;
|
||||
case IndexSize: return t.indexBytes;
|
||||
case ToastSize: return t.toastBytes;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
|
@ -207,5 +221,17 @@ QVariant TablesTableModel::data(const QModelIndex &index, int role) const
|
|||
return getData(index);
|
||||
else if (role == CustomDataTypeRole)
|
||||
return getType(index.column());
|
||||
else if (role == CustomDataMeaningRole) {
|
||||
switch (index.column()) {
|
||||
case TotalSize:
|
||||
case TableSize:
|
||||
case IndexSize:
|
||||
case ToastSize:
|
||||
return static_cast<int>(DataMeaningBytes);
|
||||
default:
|
||||
return static_cast<int>(DataMeaningNormal);
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue