Reputation: 167
I have my objects with their properties. Objects could change their structure: properties may be added/removed/changed. Objects could be absolutely dropped. So object's metadata (description, classes, call them like you want :) )could be changed.
The database should store objects schemas and instances of these objects.
What's the best way to organise a relational database structure to store data mentioned above?
Currently I see only two ways:
please, don't ask why/for what I need this. Just need to store custom objects and DB should work fast :)
Upvotes: 2
Views: 2789
Reputation: 2353
With relational DB there are several options to go.
CREATE TABLE
, ALTER TABLE
etc.).Apart from relational DBs you can try NoSQL db, e.g. mongodb. I've just ran some tests and a collection with 5M objects works reasonably fast. Obviousely NoSQL solution dosen't fit into your relational requirement, but if you have some time just give it a try.
Upvotes: 0
Reputation: 117313
I'd store the schema as a blob of XML and the data as another blob of XML. You can easily serialize/unserialize this and there are standards for XML schemas already.
If you need to index some part of the data for fast retrieval, then I'd pull that information out into additional columns on which you can index. But certainly keep the XML blobs.
Upvotes: 0
Reputation: 100013
Serialize. In Java, literally, Serialize. In Python, pickle. In other languages, use whatever they got. Store the results in a blobby column. Go out for a beer.
Upvotes: 2