POSTGRESQL奇怪的更新时间? [英] POSTGRESQL strange update time?

查看:65
本文介绍了POSTGRESQL奇怪的更新时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,
我试图从vbnet应用程序中查找对postgres发生奇怪行为的一种解释。

Hy all, i'm trying to find an explanation for a strange behavior happening on postgres from a vbnet application.

第一:

1)vbnet Windows窗体应用程序

1) vbnet windows form application

2)在带有raid5的win7上的postgres 9.6(默认安装,因此所有表均启用VACUUM) )

2) postgres 9.6 on win7 with raid5 (default installation so VACUUM on for all tables)

3)npgsql 3.1.9

3) npgsql 3.1.9

4)包含250行并在其上具有唯一索引的表在更新语句的where子句中使用的字段

4) a table with 250 rows and a unique index on the field used in the where clause of the update statement

5)在交易内部取消更新

5) Un update inside a transaction

奇怪的行为就是这个更新:

the strange behavior is that this update:

UPDATE work.wip_pallets SET 
  WPAL_DATA_INI = value ,
  STAZ_ID = value, 
  WPAL_PRESENZA_CEPA = value, 
  WPAL_SCARTO = value 
WHERE CEPA_CODICE =filter value;

通常在0毫秒或少于50毫秒内运行,但有时需要400毫秒或更长的时间!随机(?)
更新必须运行以存储操作的开始时间,并且应该以
小于1s但无法预测(可能需要更长的时间)的频率触发。

normally runs in 0 or less than 50ms but in some occasion it takes 400ms or more! Randomly (?) The update have to run to store the start time of an operation and is supposed to fire at a frequence that could be less then 1s but it is not predictable (it could take longer).

有人经历过吗?
通常吗?
您是否可以尝试采取一些措施来发现问题?

Anyone experienced the same? It is normally? Do you have some actions that i can try to make in order to identify a problem?

如果可能的话,如果需要,我可以提供其他一些信息。

If possible i can provide some others information if required.

谢谢

PS
...对不起我的英语...。

P.S. ... sorry for my english ....

推荐答案

有两种可能:


  1. 重载的I / O系统。

  1. Overloaded I/O system.

并发事务锁定了表或

您可以打开自动解释


  • 添加 postgresql.conf 中的 auto_explain shared_preload_libraries

设置 auto_explain.log_analyze = on auto_explain.log_buffers = on

设置 auto_explain.log_min_duration = 100 记录所有耗时超过100毫秒的事件

Set auto_explain.log_min_duration = 100 to log everything that takes more than 100 ms.

重新启动PostgreSQL。

Restart PostgreSQL.

然后您会从日志中长期获取执行计划。这些应该提供一些信息。

Then you'll get execution plans from the long runs in the log. These should provide some information what is going on.

这篇关于POSTGRESQL奇怪的更新时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆