98
CCsaba Fekete·Közzétéve over 1 year ago

How to structure a database for a comment system?

database
I'm designing a database schema for a forum's comment system that needs to support nested replies (threads). What is a performant way to model this? I'm thinking of using a self-referencing table with a `parent_comment_id`, but I'm worried about query performance when fetching a deep thread. Are there better approaches, like using a materialized path or nested set model? My backend is PostgreSQL.

0 Hozzászólás