Design Relational Database - Use hierarchical datamodels or avoid them?

前端 未结 3 2079
盖世英雄少女心
盖世英雄少女心 2020-12-30 17:15

I\'m designing a Database and I have some doubts on using Hierarchical datamodels in relational databases.

If I want to deal with categories, subcategories and paren

3条回答
  •  盖世英雄少女心
    2020-12-30 17:55

    If you're using Postgres, you can store the hierarchy in an array as a materialized path.

    You also benefit from GIN indexing with this approach, which in my experiments has had better performance than a recursive query.

提交回复
热议问题