查看数据库表空间。海事

  

查看数据占用空间大小:

  
 <代码类=" language-shell ">选择CONCAT(圆(总和(data_length)/(1024 * 1024 * 1024), 6), GB) information_schema总数据大小的。表在table_schema像“测验”, 
  

查看指定数据库模式下的空间:

  
 <代码类=" language-shell ">选择TABLE_NAME concat(截断(data_length/1024/1024, 2),“m”)作为data_size, concat(截断(index_length/1024/1024, 2),“m”)从information_schema index_size。表在TABLE_SCHEMA=安庋椤?
  
  选择CONCAT (table_schema,“。”, table_name)的表名,table_rows“行数”,CONCAT(圆(data_length/(1024 * 1024 * 1024), 6),“G”)的数据大小,CONCAT(圆(index_length/(1024 * 1024 * 1024), 6),“G”)作为索引大小,CONCAT(圆((data_length + index_length)/(1024 * 1024 * 1024), 6),“G”)从information_schema 'Total”。表在table_schema总像“aries_account”秩序; 
  

查看该实例下所有模式的空间:

  
 <代码类=" language-shell ">选择table_schema,总和(data_length + index_length)/1024/1024 total_mb,
  总和(data_length)/1024/1024 data_mb,总和(index_length)/1024/1024 index_mb,
  count(*)表,curdate()从information_schema今天。表集团通过table_schema订单2 desc;
  
  选择concat(截断(sum (data_length)/1024/1024, 2),“m”)作为data_size,
  concat(截断(总和(max_data_length)/1024/1024, 2),“m”)作为max_data_size,
  concat(截断(总和(data_free)/1024/1024, 2),“m”)作为data_free,
  concat(截断(总和(index_length)/1024/1024, 2),“m”)作为index_size
  从information_schema.tables;  

查看数据库表空间。海事