简体   繁体   English

当我再输入〜15000个参数时,为什么PostgreSQL使用100%cpu

[英]Why postgresql use 100% cpu when i put in ANY more then ~15000 parameters

This is my query: select * from dbname where user_name = any(cast(? as text[])) 这是我的查询: select * from dbname where user_name = any(cast(? as text[]))

My conf file: 我的conf文件:

max_connections = 100
shared_buffers = 1GB
effective_cache_size = 3GB
maintenance_work_mem = 256MB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 4
effective_io_concurrency = 2
work_mem = 300MB
min_wal_size = 512MB
max_wal_size = 2GB

When i put less then ~15000 all works fine. 当我少放〜15000时,一切正常。

Postgresq 9.5. Postgresq 9.5。

Not sure if that is possible with Hibernate, but you could try a join instead: 不确定Hibernate是否可行,但是您可以尝试加入连接:

select t.* 
from tablename t 
   join unnest(cast(? as text[])) as x(name) on t.user_name = x.name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM