← Back to team overview

maria-developers team mailing list archive

Re: More enum values in enum fields

 

Roberto Spadim <roberto@xxxxxxxxxxxxx> writes:
> i see that in a near future i will have more than 65535 different values
> inside this enum column, the first solution is change it to varchar, but my
> problem will be data size
> the enum is very optimized in size, a char is 'converted' to a smallint
> value

Note that the real limit is much less than 65535. See
https://www.flamingspork.com/blog/2010/06/29/enum-now-works-properly-in-drizzle/

> my second solution is a int column, and a external table with int/text
> values, but here i need to change apps, i don't want the second one, but i
> don't want a very big database (char column)
>
> how could i change the limit of enum size?
> maybe a new enum2 type? with a limit of bigint value (64bits), ok maybe
> less (32bits)

It's probably not a good idea as the whole ENUM values need to always be
kept in memory, and going to that many is going to mean a *big* chunk of
memory that will be always used. It's much better to do the join and be
done with it, it'll end up being a lot more efficient.

-- 
Stewart Smith

Attachment: pgp5FORTKp2FU.pgp
Description: PGP signature


Follow ups

References