Add context menu to display database tables stats (#639)

* Add context menu to display database tables stats

* Move table stats implementation into client
This commit is contained in:
Dan Sosedoff
2023-01-23 14:10:26 -06:00
committed by GitHub
parent 06212b4c34
commit 5b2d4e4454
8 changed files with 94 additions and 0 deletions

View File

@@ -335,6 +335,10 @@ func (client *Client) TableConstraints(table string) (*Result, error) {
return res, err
}
func (client *Client) TablesStats() (*Result, error) {
return client.query(statements.TablesStats)
}
// Returns all active queriers on the server
func (client *Client) Activity() (*Result, error) {
if client.serverType == cockroachType {

View File

@@ -641,6 +641,25 @@ func testReadOnlyMode(t *testing.T) {
assert.NoError(t, err)
}
func testTablesStats(t *testing.T) {
columns := []string{
"schema_name",
"table_name",
"total_size",
"data_size",
"index_size",
"estimated_rows_count",
"estimated_rows",
"index_to_data_ratio",
"indexes_count",
"columns_count",
}
result, err := testClient.TablesStats()
assert.NoError(t, err)
assert.Equal(t, columns, result.Columns)
}
func TestAll(t *testing.T) {
if onWindows() {
t.Log("Unit testing on Windows platform is not supported.")
@@ -678,6 +697,7 @@ func TestAll(t *testing.T) {
testHistory(t)
testReadOnlyMode(t)
testDumpExport(t)
testTablesStats(t)
teardownClient()
teardown(t, true)