I have a bunch of properties (columns in db) that should have a string value from a list of predefined values, for example active, inactive, pending.
Outside the database, which is javascript (deno+react in front-end) I really want to have these as string enums, and not a integers, because it adds some clarity to the code and actually reduces the amount of code you need to write.
In the database I have two options, either I store them as they are (strings), or as smallint then convert them to/from strings during the database select/insert.
Problem with the second option is that it requires additional transformation in the code, and when using typescript, this transformation is not so straightforward as doing a simple mapping, because ts doesn't let you re-assign different types to existing props, so you need to copy and do more stuff...
Anyway, I just wanted to ask, how much is the postgres performance and/or size overhead if I store them directly as strings in the db too, to eliminate transformation step? I imagine that each record would grow by around 20 bytes if I change from smallint to text and that would have some kind effect on performance? Also these columns have to be indexed, and that adds another 20 bytes for each record