Database Limit hit by a customer

jason0 wrote on Thursday, December 15, 2011:

Hello,

I just had a customer hit a row-length limit when adding a field to the demographics layout.  I looked into his database and discovered that up until then he had added 14 fields to the patient_data table.  Each of these fields is a varchar(255).

The row size limit is the sum of all of the maximum column lengths in a table.  the limit is 65535 bytes.  While a varchar can be as large as 65535 bytes, it is still subject to the maximum row length.

I learned another thing: since the database uses utf8 as its character set, each character takes 3 bytes.  thus just the addition of the 14 varchar(255)'s, my customer has increased his row length by 10,738 bytes. 

I don’t think its reasonable to continue to use varchar(255)'s for field length defaults, since each time we add a field, it increases the row length by 767 bytes.  the mysql documentation suggests using type “text” instead of varchar.  I found the two locations to change this (line 143, line 244 in interface/super/edit_layout.php). 

Does anyone know a good reason not to use type text? 

yehster wrote on Thursday, December 15, 2011:

The main  advantage of varchar versus text is performance.  It’s a complicated issue and here is some guidance.

http://forums.mysql.com/read.php?24,105964,105964