2010/7/28 Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx>
Thank you Craig,
Yes, I was not very specific. I have an idea in mind. Everyone knows about Craig's List and the hype about NoSql databases. This seems to be cool to do full text searches in a lot of data. But what about doing more formal searches based specific criteria like dates, numbers or other kind values on specific fields? This where an SQL database shines.
What I would like to do is enable users to create their own data model. Enable them to create a model and make it evolve. For example, it would be cool to create a model to represent car adds. Then, the buyers can search adds using the previous model with specific criteria like the color of the car they want.
I thought about using a table where each row would represents a field in the dynamic model. The row would contain a fields for each possible data type supported but only one of them would be used. This would waste a lot space and it would also be hard to query efficiently but I will not have to change the schema as users create new models. Otherwise, I would create a standard data model and apply the changes as users update their models.
I also like to support inheritance so we can have a simple model for regular adds and more specfic models with more fields for car adds for example.
I have a really hard finding how to implement my idea efficiently. So the advice of experienced database developers is what I am looking for.
I thought about using maps for the entities of my domain model. hstore seems to be an interesting avenue.
I doubt anyone can make any useful recommendations without a moreOn 29/07/10 07:06, Pierre Thibault wrote:
complete explanation of what you're trying to achieve and why you want
to do what you have described.
Thank you Craig,
Yes, I was not very specific. I have an idea in mind. Everyone knows about Craig's List and the hype about NoSql databases. This seems to be cool to do full text searches in a lot of data. But what about doing more formal searches based specific criteria like dates, numbers or other kind values on specific fields? This where an SQL database shines.
What I would like to do is enable users to create their own data model. Enable them to create a model and make it evolve. For example, it would be cool to create a model to represent car adds. Then, the buyers can search adds using the previous model with specific criteria like the color of the car they want.
I thought about using a table where each row would represents a field in the dynamic model. The row would contain a fields for each possible data type supported but only one of them would be used. This would waste a lot space and it would also be hard to query efficiently but I will not have to change the schema as users create new models. Otherwise, I would create a standard data model and apply the changes as users update their models.
I also like to support inheritance so we can have a simple model for regular adds and more specfic models with more fields for car adds for example.
I have a really hard finding how to implement my idea efficiently. So the advice of experienced database developers is what I am looking for.
Re Pg-specific stuff, you should look into hstore. It might offer a way
to avoid the need for dynamic table re-structuring.
I thought about using maps for the entities of my domain model. hstore seems to be an interesting avenue.
--
A+
-------------
Pierre