John Davidson

Is storing a delimited list in a database column really that bad?

0 comments
Message:


Imagine a web form with a set of check boxes (any or all of them can be selected). I chose to save them in a comma separated list of values stored in one column of the database table.



Now, I know that the correct solution would be to create a second table and properly normalize the database. It was quicker to implement the easy solution, and I wanted to have a proof-of-concept of that application quickly and without having to spend too much time on it.



I thought the saved time and simpler code was worth it in my situation, is this a defensible design choice, or should I have normalized it from the start?



Some more context, this is a small internal application that essentially replaces an Excel file that was stored on a shared folder. I'm also asking because I'm thinking about cleaning up the program and make it more maintainable. There are some things in there I'm not entirely happy with, one of them is the topic of this question.



My Answer:
Storing a delimited list in a database column is generally not recommended as it goes against the principles of database normalization. It can lead to issues such as data redundancy, difficulty in querying the data, and potential data integrity problems.

While it may have been quicker to implement initially, it can lead to maintenance headaches down the line as the application grows and evolves. It's always best to follow best practices in database design to ensure scalability, maintainability, and data integrity.

In your situation, where it is a small internal application replacing an Excel file, it may not be as critical to immediately normalize the data. However, as you mentioned that you are thinking about cleaning up the program and making it more maintainable, it would be a good idea to consider normalizing the data at that point.

Ultimately, the decision to normalize the data or not depends on the specific requirements and constraints of your application. It's important to weigh the trade-offs and consider the long-term implications of your design choices.

Rate this post

5 of 5 based on 5113 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us