Optimized SQL for tree structures

前端 未结 11 883
耶瑟儿~
耶瑟儿~ 2020-11-28 21:39

How would you get tree-structured data from a database with the best performance? For example, say you have a folder-hierarchy in a database. Where the folder-database-row h

11条回答
  •  [愿得一人]
    2020-11-28 22:30

    Celko wrote about this (2000):

    http://www.dbmsmag.com/9603d06.html

    http://www.intelligententerprise.com/001020/celko1_1.jhtml;jsessionid=3DFR02341QLDEQSNDLRSKHSCJUNN2JVN?_requestid=32818


    and other people asked:

    Joining other tables in oracle tree queries

    How to calculate the sum of values in a tree using SQL

    How to store directory / hierarchy / tree structure in the database?

    Performance of recursive stored procedures in MYSQL to get hierarchical data

    What is the most efficient/elegant way to parse a flat table into a tree?


    finally, you could look at the rails "acts_as_tree" (read-heavy) and "acts_as_nested_set" (write-heavy) plugins. I don't ahve a good link comparing them.

提交回复
热议问题