![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We're having a pseudo-debate over the "correct" size to make fields in our app. Our framework's persistence layer is mostly RDBMS-agnostic. Some of us old-timers use varchar(255) [or that newfangled nvarchar(255)] mostly for historic reasons. The young-bloods tend to be using varchar(256) [though I even wonder about the logic of that]. Assuming you are trying to come up with a "rule of thumb" for character fields for values such as "description", what practice do you tend to prescribe? |
#3
| |||
| |||
|
|
greg.fenton wrote on 22.01.2007 23:13: We're having a pseudo-debate over the "correct" size to make fields in our app. Our framework's persistence layer is mostly RDBMS-agnostic. Some of us old-timers use varchar(255) [or that newfangled nvarchar(255)] mostly for historic reasons. The young-bloods tend to be using varchar(256) [though I even wonder about the logic of that]. Assuming you are trying to come up with a "rule of thumb" for character fields for values such as "description", what practice do you tend to prescribe? Neither 255 nor 256! I have never understood what would be that special in a DBMS about 255 or 256 (I never worked with something like dBase, where there might have been some limits because of using a single byte for the length) |
|
255, 256, 274, 301, 545, 42. Where is the difference? The size should be driven by business requirements, not by some obscure technical "reasons". |
|
If I don't know any restrictions, I choose the max. size the DBMS supports for a varchar field. For any decent DBMS this simply shouldn't matter at all. Neither in speed nor in space requirements. |
#4
| |||
| |||
|
|
I have never understood what would be that special in a DBMS about 255 or 256 (I never worked with something like dBase, where there might have been some limits because of using a single byte for the length) |
|
255, 256, 274, 301, 545, 42. Where is the difference? The size should be driven by business requirements, not by some obscure technical "reasons". |
#5
| |||
| |||
|
|
The business requirement is that we need a field to hold enough information without allowing the user to write a book. |
|
Think of a table with 80M rows. What is the I/O penalty for choosing a row definition that causes row-splitting to 30% of the data. Now, when looking at physical design in a specific instance you have the ability to look at the complete schema (and hopefully a full test environment) to determine optimal definition. But when initially designing an application that is to evolve overtime, one needs to start somewhere. |
![]() |
| Thread Tools | |
| Display Modes | |
| |