Re: Rules of thumb for field sizes?
Posted by: Filipe Silva
Date: December 03, 2015 05:25AM

Hi Macaba,

Not really. What you should understand is what's the cost of using different data types and their storage limitations. Whether you choose to let the database enforce your field's limits or you do it in the client application is up to you.

Say, in your example, you could get a little advantage by using CHAR(6) instead of VARCHAR(6) in the field 'postcode' if know for sure that all the six chars will be used in all records. This would make you gain one byte per row (see also dev.mysql.com/doc/refman/5.7/en/char.html). This it nitpicking but, well, it's just an example.

Regarding the impacts in Connector/J the only real difference is if you are willing to enforce and check data limits preemptively or reactively. The later case would throw exceptions back and would require additional round trips to the database. But, again, it's up to you.

Options: ReplyQuote


Subject
Written By
Posted
November 16, 2015 07:29AM
Re: Rules of thumb for field sizes?
December 03, 2015 05:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.