Postgresql fails specific query ONE time after Windows reboot

心已入冬 提交于 2019-12-05 20:23:50

With some help I found the solution in the Npgsql docs, here.

Npgsql by default comes with some timeout parameters for connection and commands. After a Windows reboot, first access to the table was very slow, triggering the command timeout.

With additional parameters on the connection string I was able to change those settings higher and solve my problem:

connectionString += ";Timeout=180;Command Timeout=180";

Bonus tip: a Postgresql function pg_sleep(seconds) helped me reproduce the problem without actual reboots. Very helpful:

SELECT pg_sleep(60);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!