Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No. This is binding your data structure to a single access pattern. You can get all the reviews for a restaurant. Now what if you want all the reviews left by a particular user?

I invite you to read the original relational database paper which addresses this exact use case: A Relational Model of Data for Large Shared Data Banks



Storing such data structure would be binding to a single access pattern, I agree. But a query to retrieve such structure is simply convoluted for no reason to the point of many people resorting to hacks like json_agg.


Make a SQL view for the tree and a function in the client application which can read a tree in its linear projected form.


If SQL were flexible, I wouldn’t need to create a whole view for a single query.


You’re telling me there are two presentations of reviews (by restaurant and by user) but it’s too much work to define a query for those two views.

I guess your app can just not support that feature and keep the tree? What do you want to hear?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: