1

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?

2
  • 3
    You might find this article and accompanying discussion on Hacker News interesting: news.ycombinator.com/item?id=496946 Commented 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. Commented Oct 22, 2010 at 22:24

4 Answers 4

5

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Ya, I do not need the values at all, except for at retrieval. thx
and i do have columns for things that needs to be indexed
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.
2

No different than people storing XML snippets in a database (that doesn't have XML support). Don't see any harm in it, if it really doesn't need to be searched at the DB level. And the great thing about JSON is how parseable it is.

Comments

2

I don't see why not. As a related real-world example, WordPress stores serialized PHP arrays as a single value in many instances.

Comments

0

I think,It's beter serialize your XML.If you are using python language ,cPickle is good choice.

1 Comment

Why? There may be valid reasons, but just saying 'use XXX instead' is not very useful...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.