[TYPO3-english] Duplicate cHash values
Xavier Perseguers
typo3 at perseguers.ch
Mon Jan 19 15:40:15 CET 2009
Hi,
> Now I have tx_realurl_chashcache table like (it differs from standart
> RealURL table - spurl_hash already store full MD5 value):
>
> CREATE TABLE `tx_realurl_chashcache` (
> `spurl_hash` VARCHAR(32) NOT NULL DEFAULT '',
> `chash_string` VARCHAR(10) NOT NULL DEFAULT '',
> )
>
> If extend chash_string to full MD5 it will be VARCHAR(32),
> and each record will occupy 64 bytes.
>
> But if use BINARY(16) for both fields, then each record will occupy only 32 bytes.
We should use CHAR vs VARCHAR whenever we know the length as it saves 1
char/record. That is 1 byte when not dealing with strange charset.
Whereas using BINARY will be charset-unaware and will allow to reduce to
16 bytes as already said.
For standard charset:
VARCHAR(32) is stored as 1 byte for the length (32 fit in 1 byte) + 32
bytes (because of 32 chars being used) = 33 bytes of "readable" characters
CHAR(32) => exactly 32 bytes that are still readable (thus in exa)
BINARY(16) => 16 bytes "unreadable"
--
Xavier Perseguers
http://xavier.perseguers.ch/en/tutorials/typo3.html
More information about the TYPO3-english
mailing list