r/DatabaseHelp • • Mar 25 '21

Modelling Data with Nested Comments - Retrieve Top Parent Post?

/r/learnSQL/comments/mcvu9p/modelling_data_with_nested_comments_retrieve_top/
3 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/phunkygeeza Mar 26 '21

Did you check out your source data deserialising code?

It's a common mistake to skip parent/child relationships implied by the hypermedia structure if they are not explicitly provided as a child attribute.

JSON sucks at this because it lacks an easy parent path accessor like XML has.

2

u/Dan6erbond Mar 26 '21

I'm not exactly sure what you mean with the deserialization. To be clear, this is my database and I'm trying to model it correctly with as little redundant data as possible.

With the recursive CTEs I don't have any problems anymore, I can get the parent post "efficiently" when I need it, and have a clean enough folder structure which I only intend to update if I ever run into performance issues with this method.

Thanks for the advice!

1

u/phunkygeeza Mar 26 '21

I may have misread your comment about 'Reddit' and assumed you were pulling data from the API.