Database Structure Advice Needed

前端 未结 8 790
别跟我提以往
别跟我提以往 2021-01-29 23:15

Im currently working on a site which will contain a products catalog. I am a little new to database design so I\'m looking for advice on how best to do this. I am familiar wit

8条回答
  •  半阙折子戏
    2021-01-29 23:41

    Before you create a hierarchical category model in your database, take a look at this article which explains the problems and the solution (using nested sets).

    To summarize, using a simple parent_category_id doesn't scale very well and you'll have a hard time writing performant SQL queries. The answer is to use nested sets which make you visualize your many-to-many category model as sets which are nested inside other sets.

提交回复
热议问题