db - amend SizeTable method
This commit is contained in:
parent
d0c32af175
commit
b699de3611
2
db/db.go
2
db/db.go
|
@ -178,7 +178,7 @@ type TableSize struct {
|
|||
func (db *Db) SizeTable(dbname string) []TableSize {
|
||||
rs := make([]TableSize, 1)
|
||||
db.onDbExec("information_schema", func(sqlDb *sql.DB) bool {
|
||||
query := "SELECT `TABLE_NAME` AS `table`, ROUND(((`DATA_LENGTH` + `INDEX_LENGTH`) / 1024 / 1024), 2) `size` FROM `TABLES` WHERE `table_schema` = ? AND (`DATA_LENGTH` + `INDEX_LENGTH`) > O RDER BY (`DATA_LENGTH` + `INDEX_LENGTH`) DESC;"
|
||||
query := "SELECT `TABLE_NAME` AS `table`, ROUND(((`DATA_LENGTH` + `INDEX_LENGTH`) / 1024 / 1024), 2) `size` FROM `TABLES` WHERE `table_schema` = ? AND (`DATA_LENGTH` + `INDEX_LENGTH`) > ORDER BY (`DATA_LENGTH` + `INDEX_LENGTH`) DESC;"
|
||||
rows, err := sqlDb.Query(query, dbname)
|
||||
if err != nil {
|
||||
fmt.Printf("cannot get table size of db %s : %v", dbname, err)
|
||||
|
|
Loading…
Reference in New Issue
Block a user