You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
Thank you for your answer. So if in the future I need to add a few more columns to extend functionality, it would still be better then EAV? For instance, if a table has 1 million records, adding 5 optional fields to the events table will add 5 million empty fields to the database. Using EAV would add 0 empty fields. This is the only concern I have. Do you think even in this situation it would still be better to add columns to the appropriate table then to just add a event_meta table?alwaysStuck– alwaysStuck2014-08-06 15:58:06 +00:00Commented Aug 6, 2014 at 15:58
-
@alwaysStuck If you want to use relational databases, you should adhere to normal forms. If you want to use no-sql databases, that are key-value-based, non relational type of databases, you can do as you are proposing here. Also a great number of optional fields in an entity is a bad design, indicating an extra entity is needed. For example a doctor-guild-number in the person table will be empty for almost everyone, a doctor-table with a one-one relationship with person should hold all attributes only applicable to doctors.Tulains Córdova– Tulains Córdova2014-08-06 16:07:07 +00:00Commented Aug 6, 2014 at 16:07
-
1@alwaysStuck: There's nothing wrong with using a SQL database table as a Key/Value store or EAV, if Key/Value or EAV are the right tools for the task.Robert Harvey– Robert Harvey2014-08-06 16:44:07 +00:00Commented Aug 6, 2014 at 16:44
-
1@alwaysStuck -- one thing we've used successfully for things like this would be to have an extra metadata field that is just a serialized object. The key caveat there is it works great if you never, ever need to query on the contents.Wyatt Barnett– Wyatt Barnett2014-08-06 16:54:20 +00:00Commented Aug 6, 2014 at 16:54
-
@alwaysStuck: existing table rows are not modified when a new column is added to the table.kevin cline– kevin cline2014-08-06 16:59:09 +00:00Commented Aug 6, 2014 at 16:59
|
Show 2 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you