A probe into the efficiency of database type space (v)

Source: Internet
Author: User

Next, Test

char (1) default NULL, char (1) NOT null default ', char ($) default NULL, char (+) NOT null default ' '

varchar (1) default NULL, varchar (1) NOT null default ' ', varchar ($) default NULL, varchar (+) NOT null default ' '

nvarchar (1) default null, nvarchar (1) NOT null default ', nvarchar ($) default null, nvarchar (+) NOT null default '

tinyint default NULL, tinyint int NOT null default 0

int default NULL, int not NULL, default 0

Text default NULL, text NOT NULL default '

Table data volume 222,300, occupied space 44.494M

The SQL statement used

Add column: ALTER TABLE t_type add Column New_column char (1) default null;

Modify column: ALTER TABLE t_type modify New_column char ($) default null;

Delete column: ALTER TABLE t_tpye drop column new_column;

View Space:

Select Concat (Round (sum (data_length/1024/1024), 3), ' MB ') as Data_size,
Concat (Round (sum (max_data_length/1024/1024), 3), ' MB ') as Max_data_length,
Concat (Round (sum (data_free/1024/1024), 3), ' MB ') as Data_free,
Concat (Round (sum (index_length/1024/1024), 3), ' MB ') as Index_length
From Information_schema.tables where table_name= ' T_type '

Occupy space char (1) default null char (+) default null char (+) default null char ($) Default null
Data_size (MB) 45.123 44.922 44.922 44.922
Index_length (MB) 2.256 2.256 2.256 2.256
Data_free (MB) 0 0 0 0
Occupy space char (1) NOT null default ' ' char (a) NOT null default ' ' char (+) NOT null default ' ' char ($) NOT null default ' '
Data_size (MB) 44.922 44.721 44.721 44.721
Index_length (MB) 2.256 2.256 2.256 2.256
Data_free (MB) 0 0 0 0
New_column char (+) NOT null default ' ' Insert character n a\ Ah
Occupied space \ Number of characters inserted 1 (a\ AH) 2 (aa\ ah AH) 2 (a AH/AH a) 3 (aaa/ah ha) (a...a/ah ... /full half-width mixing)
Data_size (MB) 45.729\46.733 46.733\48.961 48.961/48.961 48.961/48.961 63.377/66.617/67.617
Index_length (MB) 2.256 2.256 2.256 2.256 2.256
Data_free (MB) 0 0 0 0 4.24

A probe into the efficiency of database type space (v)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.