I'm using PostgreSQL
in my WPF Application
.
Sometime the PostgreSQL
makes CPU Usage up-to 100%.
I have encountered this issue many time, but I don't know the reason.
The snapshot image in Task Manager is below
Note that, When this bug occurs, I kill my application exe, and wait for during 5 minutes after that, but the status in task manager still not change. CPU still 100%
I see that, it usually happens after Window Update. And I must restart the computer to by pass this.
I'm using PostgreSQL 9.3
.
Anyone can show me the way to fix this.
Thank you :)
If you are able to still access postgres, one thing I'd look at is do you have any queries that might be hung up
SELECT
pid,
now() - pg_stat_activity.xact_start AS duration,
query,
state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '4 minutes';
if there is indeed a query that has been alive longer than it should be, you can delete like so:
SELECT pg_cancel_backend(<pid>);
This might not be the problem, but it will at least reduce the number of possibilities.
如果您不在数据库中使用索引,那么大多数情况下会出现问题,请对经常使用的字段使用索引,特别是如果您使用“order by”或聚合(例如 sum 和 count)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.