My php.ini is configured to generate 32 character long session ids with following settings:
session.entropy_file = /dev/urandom
session.entropy_length = 512
session.hash_function = 1
session.hash_bits_per_character = 5
Thus the string should always be 32 characters long. Is char(32) the most appropriate column type to use if I will be using this column in where statements and having an index on it? Any other best practices I should be aware of?
Thanks
It would make sense to use CHAR
for fixed-length strings. It would also save space in comparison to using VARCHAR
(again assuming that all values in the column are of same length).
If there is uncertainty in the length of values in the column, there VARCHAR
would be a preferred choice.
Also see String Type Overview.