Postgres重新索引索引并发未完成

huangapple go评论57阅读模式
英文:

Postgres reindex index concurrently not finishing

问题

我在我的PostgreSQL服务器版本13上遇到了一个奇怪的行为。
索引非常小。当我运行:

reindex index my_index_name;

非常快。但是当我尝试

reindex index concurrently my_index_name;

它无法完成。它运行了几天。服务器上没有锁定,什么都没有。这里可能的问题是什么?

英文:

I have a strange behavior on my postgres server version 13.
The index is very small. When I run:

reindex index my_index_name;

It is very fast. But when I try

reindex index concurrently my_index_name;

It won't finish. It runs for days. There are not lock on the server, nothing. What can be the problem here?

答案1

得分: 2

我找到了问题:
有很多处于事务空闲状态的开放连接。

这些连接阻止了重新索引的启动。它总是在等待旧快照的阶段(通过使用 select * from pg_stat_progress_create_index; 查看)。

我重新启动了PostgreSQL服务器,现在一切正常运行。

英文:

I found the problem:
There were many open connections with the stat Idle in transaction.

This connections prevented the reindex to start. It was always in the phase waiting for old snapshot (seen with select * from pg_stat_progress_create_index;
)

I restarted the postgres server, now everything works fine.

huangapple
  • 本文由 发表于 2023年2月27日 17:06:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/75578517.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定