Merge pull request #595 from sosedoff/indexes-list-include-sizes

Include index size on the index list view
This commit is contained in:
Dan Sosedoff 2022-12-03 16:46:36 -06:00 committed by GitHub
commit 18f8f35672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -314,7 +314,7 @@ func testTableIndexes(t *testing.T) {
res, err := testClient.TableIndexes("books")
assert.Equal(t, nil, err)
assert.Equal(t, 2, len(res.Columns))
assert.Equal(t, []string{"index_name", "index_size", "index_definition"}, res.Columns)
assert.Equal(t, 2, len(res.Rows))
}

View File

@ -50,7 +50,9 @@ WHERE
TableIndexes = `
SELECT
indexname, indexdef
indexname AS index_name,
pg_size_pretty(pg_table_size(indexname::regclass)) AS index_size,
indexdef AS index_definition
FROM
pg_indexes
WHERE