【发布时间】:2022-01-29 00:43:01
【问题描述】:
传递给 WHEREIN eloquent 方法的数组中元素的数量和/或它们的长度是否有限制? 例如:
$skuChunks = array_chunk($skus, 20);
foreach ($skuChunks as $chunk) {
BCProduct::whereIn('sku', $chunk)->update(['flag' => $flagValue]);
}
除了 20 之外,我可以使用的最大数字是多少? 如果 SKU 的长度为 10 个符号,与长度为 5 个符号相比,这会影响元素的数量($chunk 大小)吗?
谢谢
【问题讨论】:
-
PHP 使用 php.ini 中指定的 memory_limit。 Mysql 使用 [max_allowed_packet] (stackoverflow.com/questions/4275640/mysql-in-condition-limit/…)
-
这能回答你的问题吗? MySQL number of items within "in clause"