NpgsqlConneciton, NpgsqlCommand都有CommandTimeout属性值,单位为毫秒,默认值为90秒。如果命令执行时间超过CommandTimeout值,就会发生timeout错误,即执行时间超出设定时间。所以,解决方式就是将CommandTimeout值设置足够大。