In the latest version of MariaDB, there have been issues with extremely long product list indexing.
After analysis, it was discovered that the problem lies with type casting by the database. Below is a quick fix that can be applied in the file Magento/Framework/DB/Adapter/Pdo/Mysql.php:
1public function quoteInto($text, $value, $type = null, $count = null)2{3 if (is_array($value)) {4 foreach($value as &$val) {5 $val = $this->castNumeric($val);6 }7 } else {8 $value = $this->castNumeric($value);9 }1011 if (is_array($value) && empty($value)) {12 $value = new \Zend_Db_Expr('NULL');13 }1415 if ($value instanceof \DateTimeInterface) {16 $value = $value->format('Y-m-d H:i:s');17 }1819 return parent::quoteInto($text, $value, $type, $count);20}2122private function castNumeric($val)23{24 if (is_numeric($val)) {25 return $val + 0;26 }27 return $val;28}
Solution based on:
https://github.com/magento/magento2/pull/25212/commits/b4a6b68e2d4ad403b1e85e8abdf829fb14dd2138