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:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user