I notice that some databases like Postgres add Enum
but the question is,
integer/string based enum
becomes a performance issue?Following this answer about differences Postgresql enum what are the advantages and disadvantages?
Because when you use Rails or in this case Ecto
from Elixir language, there is a level of abstraction so the one of the two advantages listed there becomes no an problem at all so there is only missing performance
concern.
So when that advantage is really important that you dropped the disadvantages listed there
Enum in PostgreSQL
supported by PostgreSQL for Create Data Type.
static data with ordered set values (Which is can be sort by PostgreSQL)
For Performance issue: PostgreSQL never has performance issue cause by data-type. most of them cause by indexing, configuration, and bad database design.
For Enum: in PostgreSQL They are equivalent to the enum types supported in a number of programming languages. An example of an enum type might be the days of the week, or a set of status values for a piece of data.
The translations from internal enum values to textual labels are kept in the system catalog pg_enum
. Querying this catalog directly can be useful.
Note: both Native or String/Integer based type enum can't cause performance issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With