Re: Need explanation on string data size and storage requirement.
Hello. Would both of the above tables have 2^32 - 1 characters?=20 No. TEXT types are variable-length types. For each one, the storage requirements depends on the actual length of column values, rather than on the type's maximum possible size. See: http://dev.mysql.com/doc/mysql/en/storage-requirements.html Sunil Vishwas [EMAIL PROTECTED] wrote: Hi Bruce, I am not much worried about pre 5.0.11-Beta, my question is: How the following tables would be stored: CREATE TABLE NonUnicodeTable (NonUnicodeColumn LONGTEXT); CREATE TABLE UnicodeTable (UnicodeColumn LONGTEXT UNICODE); Would both of the above tables have 2^32 - 1 characters?=20 Thank you, Sunil Vishwas=20 -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Need explanation on string data size and storage requirement.
On Aug 23, 2005, at 10:20 AM, Sunil Vishwas wrote: I was looking into the storage requirement for the various data types and got confused by following comment: 'For the CHAR, VARCHAR, and TEXT types, L and M in the preceding table should be interpreted as number of bytes before MySQL 4.1 and as number of characters thereafter.' Then I looked into other pages like http://dev.mysql.com/doc/mysql/en/string-type-overview.html http://dev.mysql.com/doc/mysql/en/string-type-overview.html and got more confuse. How it would be possible to use the same storage size to store the equal number of characters and byte, if a character is not just a byte long? For example UTF-8 based Unicode character may take 1 to 4 bytes. There is the issue... before 4.1 the limit was a size, from 4.1 onwards the limit is the number of characters... So clearly from 4.1 onwards your table sizes may vary depending on your character set choices. Look at it like this... If you have a limit of 8 bytes on a password field, and you convert your database to UTF-8 in 4.1 your password could be much larger than 8 bytes, and may be truncated if the limit were size based, instead it is character based. Allowing a full conversion of data from 4.0 to 4.1 if managed correctly. Best Regards, Bruce -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Need explanation on string data size and storage requirement.
Hi Bruce, I am not much worried about pre 5.0.11-Beta, my question is: How the following tables would be stored: CREATE TABLE NonUnicodeTable (NonUnicodeColumn LONGTEXT); CREATE TABLE UnicodeTable (UnicodeColumn LONGTEXT UNICODE); Would both of the above tables have 2^32 - 1 characters? Thank you, Sunil Vishwas -Original Message- From: Bruce Dembecki [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 23, 2005 12:29 PM To: Sunil Vishwas Cc: mysql@lists.mysql.com Subject: Re: Need explanation on string data size and storage requirement. On Aug 23, 2005, at 10:20 AM, Sunil Vishwas wrote: I was looking into the storage requirement for the various data types and got confused by following comment: 'For the CHAR, VARCHAR, and TEXT types, L and M in the preceding table should be interpreted as number of bytes before MySQL 4.1 and as number of characters thereafter.' Then I looked into other pages like http://dev.mysql.com/doc/mysql/en/string-type-overview.html http://dev.mysql.com/doc/mysql/en/string-type-overview.html and got more confuse. How it would be possible to use the same storage size to store the equal number of characters and byte, if a character is not just a byte long? For example UTF-8 based Unicode character may take 1 to 4 bytes. There is the issue... before 4.1 the limit was a size, from 4.1 onwards the limit is the number of characters... So clearly from 4.1 onwards your table sizes may vary depending on your character set choices. Look at it like this... If you have a limit of 8 bytes on a password field, and you convert your database to UTF-8 in 4.1 your password could be much larger than 8 bytes, and may be truncated if the limit were size based, instead it is character based. Allowing a full conversion of data from 4.0 to 4.1 if managed correctly. Best Regards, Bruce -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]