50000 Ids 检查代码点火器中的 where 子句

Kan*_*anu 2 php mysql codeigniter

我试过下面的查询

  $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();
Run Code Online (Sandbox Code Playgroud)

运行时出现这个错误

**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
Run Code Online (Sandbox Code Playgroud)

请建议如何解决这个问题。

Jus*_*nas 5

尝试分批运行

$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());
}
Run Code Online (Sandbox Code Playgroud)