我使用postgres 13并使用use_remote_estimate: on和fetch_size: 10000创建了一个外部服务器。tableA这里是created_date的一个分区表。如果记录数在3M左右,但对超过3M的记录抛出错误,则查询运行良好。
select
date_trunc('month', created_date)::date as month,
count(distinct category_id) as categorys,
count(distinct user_id) as workers
from
test.tableA A
where
is_expired = false
and pool in (1, 2, 4, 6, 10)
and created_date >= (select now() - interval '180 days')
group by 1
错误:
ERROR: SSL connection has been closed unexpectedly
CONTEXT: remote SQL command: CLOSE c48
WARNING: no connection to the server
Query failed
PostgreSQL said: SSL connection has been closed unexpectedly
是否需要为处理大数据添加任何配置?
发布于 2022-12-06 13:32:32
很可能存在一个网络组件,它强制关闭空闲一定时间的TCP连接。如果无法修复该网络组件,则可以尝试更频繁地发送TCP保活数据包,以使连接保持忙碌:
keepalives_idle = 120
。tcp_keepalives_idle = 120
每两分钟发送一次保活包。通常,使用上述选项之一是足够好的。
https://dba.stackexchange.com/questions/320606
复制相似问题