db - amend SizeTable method
This commit is contained in:
parent
5da7e42219
commit
f084d5b740
2
db/db.go
2
db/db.go
|
@ -175,7 +175,7 @@ type TableSize struct {
|
||||||
Size float32
|
Size float32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Db) SizeTable(dbname string, table string) []TableSize {
|
func (db *Db) SizeTable(dbname string) []TableSize {
|
||||||
rs := make([]TableSize, 1)
|
rs := make([]TableSize, 1)
|
||||||
db.onDbExec("information_schema", func(sqlDb *sql.DB) bool {
|
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 = ? ORDER BY (data_length + index_length) DESC GROUP BY table_schema;"
|
query := "SELECT table_name AS `table`, round(((data_length + index_length) / 1024 / 1024), 2) `size' FROM TABLES WHERE table_schema = ? ORDER BY (data_length + index_length) DESC GROUP BY table_schema;"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user