3 ms·
Can you store hierarchial comments like the follwoing in postgres? Is there a definite architectural pattern to store hierarchial comments?
by abhishekjha 4y ago
Can you store hierarchial comments like the follwoing in postgres?
Is there a definite architectural pattern to store hierarchial comments?
- eurasiantiger 4y agoYes. Create a comments table, and have a parent_id column on it.
- abhishekjha 4y agoQuerying it in realtime would be very expensive. You will have to keep joining for too long to find all the comments in a thread.
- eurasiantiger 4y agoAnd that’s why graph databases. Practically, you always need to limit the recursion depth anyway (can’t show infinite depth on an UI), so you might be able to make do with postgre.