資料MySQL占用空間數

2021-08-06 07:42:57 字數 1465 閱讀 7284

資料資訊在information_schema資料庫中

統計整個資料庫占用空間數:

select concat(round(sum((data_length+index_length)/1024/1024),2),'m') from tables; 

統計單個資料庫及表占用空間數

select concat(round(sum((data_length+index_length)/1024/1024),2),'m') from tables where table_schema='collect_data' and table_name='l_comm'; 

統計單個資料庫占用空間數(按表排列)

select table_name,round(sum((data_length+index_length)/1024/1024),2) as datasize from tables where table_schema='collect_data' group by table_name order by datasize desc;

information_schema中的表主要有:

schemata表:這個表裡面主要是儲存在mysql中的所有的資料庫的資訊

tables表:這個表裡儲存了所有資料庫中的表的資訊,包括每個表有多少個列等資訊。

columns表:這個表儲存了所有表中的表字段資訊。

statistics表:儲存了表中索引的資訊。

user_privileges表:儲存了使用者的許可權資訊。

schema_privileges表:儲存了資料庫許可權。

table_privileges表:儲存了表的許可權。

column_privileges表:儲存了列的許可權資訊。

character_sets表:儲存了mysql可以用的字符集的資訊。

collations表:提供各個字符集的對照資訊。

表:相當於collations表和character_sets表的前兩個欄位的乙個對比,記錄了字符集之間的對照資訊。

table_constraints表:這個表主要是用於記錄表的描述存在約束的表和約束型別。

key_column_usage表:記錄具有約束的列。

routines表:記錄了儲存過程和函式的資訊,不包含自定義的過程或函式資訊。

views表:記錄了檢視資訊,需要有show view許可權。

triggers表:儲存了觸發器的資訊,需要有super許可權。

mysql儲存plc資料 MySQL空間資料的儲存

mysql支援空間資料的儲存,再做資料儲存時,可以直接將資料轉為wkt格式。wkt幾何物件表示的示例 請注意,點座標對以逗號分隔 point 6 10 linestring 3 4,10 50,20 25 polygon 1 1,5 1,5 5,1 5,1 1 2 2,2 3,3 3,3 2,2 2...

mysql空間資料型別解釋 MySQL空間資料型別

mysql空間資料型別講解 mysql具有與opengis類對應的資料型別。某些型別只能儲存單個幾何值 geometry point linestring polygon geometry能夠儲存任何型別的幾何值。其他的單值型別point linestring以及polygon只能儲存特定幾何型別的...

mysql空間資料相關操作

建表語句 create table ts.points name varchar 20 not null location point notnull description varchar 200 新增記錄如下 insert into points name,location values p1 ...