I have been thinking about the best way to store product / customer / and transaction information in a database. We’re talking hundreds of thousands of records here…
I have a very clear idea about how the data would be represented on paper and it basically looks like a tree…
Car -> VW -> Golf -> 1.6 litre 5 door
The issue here is that each product in the tree needs different attributes. For example if the product was a boat it doesn’t need a “wheel size” attribute but would need “propeller size”. Anyway you get the point!
I’m very new to NoSQL have worked only with MySQL in the past but it appears that it may be the best solution here. I like the idea of not have a schema.
Does anyone have any experience building such systems? What did you go for? Any particular variant?
If you require a relational structure (e.g. a tree structure) then a relational database model is what you should use. NoSQL is best used for situations where you just want to store data with no regard for its structure.
If you want to have an arbitrary set of optional information, you could stick with a relational database and use a BLOB column to store the optional data, perhaps as a JSON string. This would probably work best for several reasons:
SELECT * FROM products WHERE catid = 123.LIKEto only return rows that contain that particular column name in the JSON blob, then manually filter the results in your code.