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

Dmitry Dulepov dmitry.dulepov at gmail.com
Thu Nov 12 09:18:33 CET 2009


Hi!

Sebastian Gebhard wrote:
> every few days I ask myself why pages.hidden has field type tinyint(4),
> today it's different - I ask you.

Because when TYPO3 was created, nobody cared about stuff like performance, usability or efficiency. Now it is changing but not fast enough.

> According to the ANALYSE() PROCEDURE of MySQL the optimal field type for
> these fields would be ENUM('0','1') NOT NULL.
> 
> I'm not a database expert, but afaik tinyint(4) requires more diskspace
> than ENUM('0','1') and is slower.

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 :)

-- 
Dmitry Dulepov
"Trust me, I am a doctor!" (c) Gregory House, M.D.




More information about the TYPO3-dev mailing list