laravel-nestedset icon indicating copy to clipboard operation
laravel-nestedset copied to clipboard

withDepth() and having() causing performance issues

Open matthiascw opened this issue 6 years ago • 1 comments

I am using the following query to get the specific level of rows:

return File::withDepth()->having('depth', '=', $currentDepth)->get()->toTree();

After hitting a certain amount of records (currently there are about 20k in total in my database) the mySQL CPU went straight to hell with that query.

Is this a known issue or is there any alternative which I can use which is more performant to achieve that task?

matthiascw avatar Jul 19 '19 14:07 matthiascw

@matthiascw running into the same issue with ~ 30K items. Have you ever found a way around this?

arondeparon avatar Nov 02 '21 13:11 arondeparon