Skip to content

Commit

Permalink
adjust the db, table visible in show accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
gouhongshen committed Mar 12, 2024
1 parent e5a1c21 commit 44780a1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/frontend/show_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ const (
idxOfComment = 5

// left the `size` as a placeholder, the value will be embedding later
// index table(__index_xxx): do not counting it into the `table_count`, but need its size.
// mo_increment_columns: do not counting it into the `table_count`, but need its size.
// subscription db: do not counting it into the `db_count`, and its size
// sys table(mo_database, mo_tables, mo_column): counting them into the `table_count`, and need their sizes
getTableStatsFormatV2 = "select " +
"( select " +
" mu2.user_name as `admin_name` " +
Expand All @@ -88,7 +92,9 @@ const (
"cast(0 as double) as `size` " +
"from " +
"mo_catalog.mo_tables as mt, mo_catalog.mo_database as md " +
"where mt.relkind != '%s' and mt.account_id = %d;"
"where md.dat_type != 'subscription' " +
"and mt.relkind in ('v','r','e','cluster') " +
"and mt.account_id in (%d, %d);"

// column index in the result set generated by
// the sql getTableStatsFormatV2
Expand Down Expand Up @@ -130,7 +136,8 @@ func getSqlForAccountInfo(accountId uint64) string {
}

func getSqlForTableStats(accountId int32) string {
return fmt.Sprintf(getTableStatsFormatV2, catalog.SystemPartitionRel, accountId)
//return fmt.Sprintf(getTableStatsFormatV2, catalog.SystemPartitionRel, accountId)
return fmt.Sprintf(getTableStatsFormatV2, accountId, sysAccountID)
}

func requestStorageUsage(ses *Session, accIds [][]int32) (resp any, tried bool, err error) {
Expand Down

0 comments on commit 44780a1

Please sign in to comment.