gpt4 book ai didi

php - 50000 个 Ids 检查 codeigniter 中的 where 子句

转载 作者:行者123 更新时间:2023-12-03 22:57:29 26 4
gpt4 key购买 nike

我尝试过以下查询

  $arrIds = array('1'=>'1111'......'50000'=>'50000'); // 50K ids here

$this->db->select('id');
$this->db->from('mytable');
$this->db->where_in('id',$arrIds);
$query = $this->db->get();
$result = $query->result_array();

运行时出现此错误

**Oops! Something's wrong!**

Severity: Warning

Message: preg_match(): Compilation failed: regular expression is too large at offset 46343

Filename: database/DB_query_builder.php

Line Number: 2395

请建议如何解决此问题。

最佳答案

尝试在 batches 中运行它

$arrIds = array('1'=>'1111'......'50000'=>'50000'); // 50K ids here

foreach (array_chunk($arrIds, 10000) as $chunkIds) {
$this->db->select('id');
$this->db->from('mytable');
$this->db->where_in('id', $chunkIds);
$query = $this->db->get();
$result = array_merge($result, $query->result_array());
}

关于php - 50000 个 Ids 检查 codeigniter 中的 where 子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61337247/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com