Closed Shanzeee closed 1 month ago
Would it be more efficient to use PostgreSQL's native ENUM type instead of EnumType.ORDINAL?
According to the documentation, a PostgreSQL Enum takes 4 bytes. So, it will be more efficient than using a STRING
value as most Enum names have more than 4 characters.
I'm encountering a warning from Hypersistence Optimizer regarding the use of EnumType.STRING for an enum attribute in my entity class. Below is the warning message:
[Hypersistence Optimizer] (Test worker) MAJOR - EnumTypeStringEvent - The [defaultLanguage] enum attribute in the entity uses the EnumType.STRING strategy, which has a bigger memory footprint than EnumType.ORDINAL. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#EnumTypeStringEvent
I understand that using EnumType.STRING can have a larger memory footprint compared to EnumType.ORDINAL. However, I'm considering the alternative of using PostgreSQL's native ENUM type.
Would it be more efficient to use PostgreSQL's native ENUM type instead of EnumType.ORDINAL?
Enviroment: -PostgreSQL version: 16.1 -Hibernate version: 6.5
Thank you for your assistance.