简体   繁体   English

同时执行创建索引 statmt 并且由于超时错误而断开连接 session。但我确实在 pg_stat_activity 中看到,它正在运行 state

[英]Executed create index concurrently statmt & it was disconnected session due to timeout error.but I do see in pg_stat_activity,it is in running state

I have executed create an index on a big table from pgAdmin, and in a while, I lost connection to the server, so the execution window closed in pgAdnin.我已经从 pgAdmin 执行了在一个大表上创建索引,并且在一段时间内,我失去了与服务器的连接,因此执行 window 在 pgAdnin 中关闭。 Then I reconnected to the server, and when checked pg_stat_activity, I do see that the create index statement is running (active) state, I just wondering to know whether this index being creating or stuck somewhere?然后我重新连接到服务器,当检查 pg_stat_activity 时,我确实看到创建索引语句正在运行(活动)state,我只是想知道这个索引是正在创建还是卡在某个地方?

  1. client disconnected with error, cancelling statement due to statement timeout客户端因错误断开连接,由于语句超时而取消语句

  2. when I reconnected to the server, in pg_stat_activity.当我重新连接到服务器时,在 pg_stat_activity. 31937 "edsadmin" "09:54:44.280176" "CREATE INDEX CONCURRENTLY idx_src_record_date ON pcd_t.l_esd_detail_report USING btree (src_record_date COLLATE pg_catalog."default") TABLESPACE pg_default;" 31937 "edsadmin" "09:54:44.280176" "在 pcd_t.l_esd_detail_report 上使用 btree (src_record_date COLLATE pg_catalog."default") 表空间 pg_default 创建索引 idx_src_record_date;"

I'm really confused here wheather it is createing or not.我真的很困惑无论它是否正在创建。

Late answer, but relevant none-the-less.迟到的答案,但仍然相关。

Based on my anecdotal experience right now, the index creation persists beyond the lifetime of the client.根据我现在的轶事经验,索引创建在客户端的生命周期之后仍然存在。

I did the following:我做了以下事情:

database=> CREATE INDEX CONCURRENTLY IX_myIndex on table(column, column2);

It paused for a few minutes, then:它停顿了几分钟,然后:

SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Succeeded.
psql (14.2 (Debian 14.2-1.pgdg110+1), server 10.18)

Immediately after reconnecting, I ran:重新连接后,我立即运行:

database=> \d table
                       Table "public.table"
     Column      |            Type             | Collation | Nullable | 
Default
-----------------+-----------------------------+-----------+----------+---------
... blah blah blah ...
Indexes:
    "IX_myIndex" btree (column, column2) INVALID

I waited a few more minutes, then checked again:我又等了几分钟,然后再次检查:

database=> \d table
                       Table "public.table"
     Column      |            Type             | Collation | Nullable | 
Default
-----------------+-----------------------------+-----------+----------+---------
... blah blah blah ...
Indexes:
    "IX_myIndex" btree (column, column2)

So, your index is likely fine.因此,您的索引可能没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM