Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
psycopg2:在CockroachDB中存储大值时,命令太大_Psycopg2_Cockroachdb - Fatal编程技术网

psycopg2:在CockroachDB中存储大值时,命令太大

psycopg2:在CockroachDB中存储大值时,命令太大,psycopg2,cockroachdb,Psycopg2,Cockroachdb,我希望将~0.5G值存储到单个字段中,但不配合: crdb_cursor.execute(sql.SQL("UPSERT INTO my_db.my_table (field1, field2) VALUES (%s, %s)"), ['static_key', 'VERY LARGE STRING']) psycopg2.InternalError: command is too large: 347201019 bytes (max: 67108864) 我已经设置了

我希望将
~0.5G
值存储到单个字段中,但不配合:

crdb_cursor.execute(sql.SQL("UPSERT INTO my_db.my_table (field1, field2) VALUES (%s, %s)"), ['static_key', 'VERY LARGE STRING'])

psycopg2.InternalError: command is too large: 347201019 bytes (max: 67108864)
我已经设置了
set CLUSTER SETTING sql.conn.max\u read\u buffer\u message\u size='1 GiB'

有没有(更好的)方法将这么大的字符串存储到
CockroachDB

客户端将一次请求整个字符串,并且不会执行字符串内搜索或匹配操作


我知道在
SQL
数据库中存储大型单数字段会对性能产生影响。

目前看来
psycopg2
无法处理如此大的字符串,蟑螂B也无法处理。CockroachDB将值保持在1MB左右,在默认配置下,限制在1MB到20MB之间

对于存储数百兆字节的字符串,我建议使用某种对象存储,然后在数据库中存储对该对象的引用。还有一个建立在蟑螂之上的blob商店的例子,它可能会给你一些想法