以下這個(gè)錯(cuò)誤有人遇到過沒 Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/xxxxxxxxx/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php on line 83 批量插入數(shù)據(jù)是:562759條評論
以下這個(gè)錯(cuò)誤有人遇到過沒
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/xxxxxxxxx/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php on line 83
批量插入數(shù)據(jù)是:562759條評論
這個(gè)是常見錯(cuò)誤吧,內(nèi)存limit設(shè)置大點(diǎn),或者一次少插入點(diǎn)
就是批量插入,一次1000條插入的
50多萬的數(shù)據(jù)本身就占很大內(nèi)存,如果你用一個(gè)數(shù)組存儲這50萬數(shù)據(jù),可以看看占多大內(nèi)存,不清楚你是一次性讀取50數(shù)據(jù)到程序,還是分批讀的,要看看代碼
ini_set('memory_limit', '-1'); 不限制內(nèi)存試試,這個(gè)還不夠,那就分批讀取,一次讀取個(gè)10w
先調(diào)整為2G看看,數(shù)據(jù)是一次性取出的