
Hey, I was just reading the new Persistent section and a thought came to me at the Custom Fields section. Have you considered implementing them as database enums? They would be vastly more efficient than storing as strings. --vk #yesod on freenode!

On Fri, Feb 25, 2011 at 7:09 AM, Vesa Kaihlavirta
Hey,
I was just reading the new Persistent section and a thought came to me at the Custom Fields section.
Have you considered implementing them as database enums? They would be vastly more efficient than storing as strings.
In theory, it's a good idea. In practice, there are a number of issues to be wary of: * Makes sure migrations don't accidentally change the meaning of data already in the database. * Make sure we're generating the correct SQL for each backend (I think the syntax is slightly different between engines). * Figure out a solution that will work for non-SQL backends. For the moment, even though it may not be the fastest, I think serializing to String via Show/Read is the most robust approach. If you want raw speed, you can always serialize to an Int instead. Just realize that if you ever accidentally change the meaning of an integer you will lose all your data ;). Michael
participants (2)
-
Michael Snoyman
-
Vesa Kaihlavirta