Performance difference between using check and a enum type?
What is the performance difference between using a check instead of a enum to make sure a value in the column doesn't exceed X?
For recent mariadb setups
Mystic last edited by
ENUMlets you specify the possible values. But if you use a value out of that set, what happens? It might be silently set to the 'first' value. Or it might give an warning that you are not noticing.
ENUMis a datatype that takes 1 byte. (Or in rare cases 2 bytes.)
CHECKis not a datatype, but active code that lets you explicitly cause an error. It can be applied to any(?) datatype.
I don't see anough "performance" difference to matter. Instead, use the technique that works better for you and your app.