回覆列表
  • 1 # 開心超人大大

    1、查詢所有資料庫佔用磁碟空間大小的SQL語句:

    select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2)," MB") as data_size,concat(truncate(sum(index_length)/1024/1024,2),"MB") as index_sizefrom information_schema.tablesgroup by TABLE_SCHEMA order by data_length desc;

    2、查詢單個庫中所有表磁碟佔用大小的SQL語句:

    select TABLE_NAME, concat(truncate(data_length/1024/1024,2)," MB") as data_size,concat(truncate(index_length/1024/1024,2)," MB") as index_sizefrom information_schema.tables where TABLE_SCHEMA = "TestDB"group by TABLE_NAMEorder by data_length desc;

    以上語句測試有效,注意替換以上的TestDB為資料庫名

  • 中秋節和大豐收的關聯?
  • 內馬爾未來有一天會達到梅西c羅的高度嗎?