Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4991

Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4993

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php:4991) in /www/htdocs/v030397/mysql-qotd/wp-includes/feed-rss2-comments.php on line 8
Comments on: Question 12: Which table will use less storage? http://mysql-qotd.casperia.net/archives/152 mysql 5.0/5.1 questions for learning purposes Fri, 06 Aug 2010 16:56:36 +0000 http://wordpress.org/?v=abc hourly 1 By: urs http://mysql-qotd.casperia.net/archives/152/comment-page-1#comment-18 urs Mon, 08 Feb 2010 18:44:01 +0000 http://mysql-qotd.casperia.net/?p=152#comment-18 <b> Answer: a The total size depends also on the charset, but in general <code>varchar</code> has to store the column value together with the length. <code>char</code> "knows" the length, as it is fixed. With MyIsam, the varchar also causes the row format to be dynamic. You can check with: <pre>- show table status like 'chartst%'; - select table_schema,table_name,data_length from information_schema.tables where table_schema='TT' and table_name like 'chartst%';</pre> </b>
Answer:

a

The total size depends also on the charset, but in general varchar has to store the column value together with the length.
char “knows” the length, as it is fixed.
With MyIsam, the varchar also causes the row format to be dynamic.

You can check with:

- show table status like 'chartst%';
- select table_schema,table_name,data_length
  from information_schema.tables
  where table_schema='TT' and table_name like 'chartst%';

]]>