PostgreSQL - REINDEX 即使在两个小时后仍在工作
PostgreSQL - REINDEX still working even after two hours
我已经在我的 PostgreSQL 数据库上启动了 REINDEX。在 GUI 中可以看到它处理了一些表,然后停止响应。看起来它仍在工作,即使在两个小时后也是如此。 GUI 没有响应,其最后一行显示:"NOTICE: table public.res_request_history" 已重新编制索引。"
我可以安全地停止 REINDEX 吗?我该怎么做才能让 REINDEX 正常工作?
谢谢。
是的,您可以使用 pg_cancel_backend(pid)。 PID 你可以找到执行 'select pg_stat_activity()'.
例如:
--Will display running queries and corresponding pid
SELECT query, pid FROM pg_stat_activity;
--You can then cancel one of them by calling this method with its pid
SELECT pg_cancel_backend(<pid>);
我已经在我的 PostgreSQL 数据库上启动了 REINDEX。在 GUI 中可以看到它处理了一些表,然后停止响应。看起来它仍在工作,即使在两个小时后也是如此。 GUI 没有响应,其最后一行显示:"NOTICE: table public.res_request_history" 已重新编制索引。"
我可以安全地停止 REINDEX 吗?我该怎么做才能让 REINDEX 正常工作?
谢谢。
是的,您可以使用 pg_cancel_backend(pid)。 PID 你可以找到执行 'select pg_stat_activity()'.
例如:
--Will display running queries and corresponding pid
SELECT query, pid FROM pg_stat_activity;
--You can then cancel one of them by calling this method with its pid
SELECT pg_cancel_backend(<pid>);