There's more...

The technique shown here should be used for static hierarchies, which are read and queried often but are updated less frequently. Book categories are a good example, since the library will not be continuously creating new categories; however, readers will often be restricting their searches to a category and its child categories. The reason for this lies in the implementation of the Nested set model in the database, which requires an update of the parent_path column (and the related database indexes) for all records whenever a category is inserted, removed, or moved. This can be a very expensive operation, especially when multiple editions are being performed in parallel transactions.

If you are dealing with a very dynamic hierarchical structure, the standard parent_id and child_ids relations will often result in better performance by avoiding table-level locks.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset