lazychaser / laravel-nestedset

Effective tree structures in Laravel 4-8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Efficiently restrict number of levels when using descendants()

aimeos opened this issue · comments

commented

For really big trees (say 100k nodes in 5+ levels), descendants() will return all those nodes and will break the application. The subquery added by withDepth() is costly the more nodes the tree has. Did you thought about adding a level column for that reason? This would speed up retrieving e.g. only the first three levels in a 100k node tree drastically.