[TYPO3-dev] Why have boolean database fields types like tinyint(4) etc?

Jigal van Hemert jigal at xs4all.nl
Thu Nov 12 10:02:26 CET 2009


Sebastian Gebhard wrote:
> Dmitry Dulepov schrieb:
> 
>> tinyint(4) is theoretically 4 bits. '0' and '1' are characters and 
>> require at least 8 bits. How they are really stored – depends ion the 
>> database engine. Regarding indexes: integer indexes are usually better 
>> than character ones.
>>
>> And the last thing: try to test if TYPO3 SQL parse supports ENUMs :)
> 
> I see, so there is not the ultimtive best solution for all environments. 
> But you would agree that tinyint(1) would be better?
> It's theoretically 1 bit, perfectly representing a boolean value.

The actual storage requirements can be found at [1].
The number behind many data types merely sets the number of positions 
for displaying the data.
TINYINT(4) uses in MySQL one byte and will reserve four positions for 
display.
ENUM('0', '1') will require in MySQL one byte as the different labels 
are converted to numeric values.

[1] http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

Regards, Jigal.




More information about the TYPO3-dev mailing list