小编wjo*_*zsi的帖子

PostgreSQL ANALYZE 执行时间超过 24 小时(仍在运行)

我使用 pg_upgrade(就地)升级了 Postgres DB 9.3.2-->10.5。我根据文档和 pg_upgrade 给出的说明做了一切。一切顺利,但后来我意识到索引没有在其中一个表中使用(也许其他表也受到影响)。

所以我ANALYZE昨天在那个桌子上开始了一个仍在运行的桌子上(超过 22 小时)......!

问题:ANALYZE执行时间这么长正常吗?

该表包含大约 30M 条记录。结构是:

CREATE TABLE public.chs_contact_history_events (
    event_id bigint NOT NULL
           DEFAULT nextval('chs_contact_history_events_event_id_seq'::regclass),
    chs_id integer NOT NULL,
    event_timestamp bigint NOT NULL,
    party_id integer NOT NULL,
    event integer NOT NULL,
    cause integer NOT NULL,
    text text COLLATE pg_catalog."default",
    timestamp_offset integer,
    CONSTRAINT pk_contact_history_events PRIMARY KEY (event_id)
);

ALTER TABLE public.chs_contact_history_events OWNER to c_chs;

CREATE INDEX ix_chs_contact_history_events_chsid
    ON public.chs_contact_history_events USING hash (chs_id)
    TABLESPACE pg_default;

CREATE INDEX ix_chs_contact_history_events_id
    ON …
Run Code Online (Sandbox Code Playgroud)

postgresql performance index disaster-recovery postgresql-10

8
推荐指数
1
解决办法
872
查看次数