Solution to the Problem of Excessive Memory Occupation in CI Framework Execution under CLI

  • 2021-07-01 06:57:21
  • OfStack

When many programmers use codeigniter CLI to perform a mass data import problem, the memory will be too high. The following is the reason and solution of this analyzer.

CI db will save all the query sql and sql execution time. For an import problem with a large amount of data like millions, the sql records executed will be saved in the content, which takes up a lot of content until the end of the script.

Solution:
When you perform a large number of db operations, remember to set:


$this->db->save_queries = FALSE;


Related articles: