There is a huge nesting of data, 12 thousand records.

For example there is:

category->category1->category1.1->category->1.1.1......и т.д. 

There may or may not be children. In addition to the output, you will need to do a search. I tried to use Nested Set, built a tree, in the end he brought me all 12 thousand records and Yii 2 issued:

 PHP Fatal Error – yii\base\ErrorException Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) 

Even if I break into requests that would not immediately bring me the whole tree, then how to deal with the search, and the normal load on the server is obtained.

The first time I encounter such a task. What is the best scheme?

  • And the example for this category->category1->category1.1->category->1.1.1 can you give? - Bulson
  • Add what you got so far right into the question or sqlfiddle. - 0xdb
  • Add a sample request or how you are trying to get / process records. Also provide the full text of the error (Exception). - Mikhail Grebenev
  • I join the previous comments: add the code. In particular, it is interesting to know what exactly went wrong with nested set? What are the search requirements? - Ramiz

0