I have some things that do not need to be indexed or searched (game configurations) so I was thinking of storing JSON on a BLOB. Is this a good idea at all? Or are there alternatives?
-
3You might find this article and accompanying discussion on Hacker News interesting: news.ycombinator.com/item?id=496946treeface– treeface2010-10-22 22:08:33 +00:00Commented Oct 22, 2010 at 22:08
-
While it works fine, as the answers say, I consider it a really bad practice. It's inevitable that you'll want to query it and/or modify it (in part) at some point in the future. Both of those operations will be impossible if you use this approach. I'm speaking from experience... one of the worst DB design decisions I ever made was more or less what you're talking about.rmeador– rmeador2010-10-22 22:24:56 +00:00Commented Oct 22, 2010 at 22:24
Add a comment
|
4 Answers
If you need to query based on the values within the JSON, it would be better to store the values separately.
If you are just loading a set of configurations like you say you are doing, storing the JSON directly in the database works great and is a very easy solution.
3 Comments
Timmy
Ya, I do not need the values at all, except for at retrieval. thx
Timmy
and i do have columns for things that needs to be indexed
Alan Geleynse
That is fine if you are indexing other columns. As long as the data in the JSON does not need to be indexed you can keep it there. You can always change the database later if you ever want to see how many users have some option set, but I am sure you have more interesting things to work on first.
I think,It's beter serialize your XML.If you are using python language ,cPickle is good choice.
1 Comment
StaxMan
Why? There may be valid reasons, but just saying 'use XXX instead' is not very useful...