Unable to Create or Drop Index Concurrently

From: Abdul Qoyyuum <aqoyyuum(at)cardaccess(dot)com(dot)au>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Unable to Create or Drop Index Concurrently
Date: 2022-08-18 05:57:48
Message-ID: CAA3DN=XSaPuxpGhznP_rNJz_AGdMFHeGXVvPt4TbwZsfrGD7fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi list,

We have a running Master-Slave High Availability set up. Naturally, we
can't run any changes on read-only databases on slave, so we have to do it
on the master node.

When trying to run the following command:

create index concurrently idx_cash_deposit_channel_id_batch_id on
cash_deposit (channel_id, batch_id);

Waiting for a long time, and my connection dropped. When checking the
table, we get the index as INVALID

Indexes:
"pk_cash_deposit" PRIMARY KEY, btree (id)
"idx_cash_deposit_channel_id_batch_id" btree (channel_id, batch_id)
INVALID

And when dropping the invalid index, also takes a long time, my connection
timed out, then when logging back in and check the table, it hasn't dropped.

Question is, do we have to shutdown traffic and close all existing open
connections in order to drop and properly recreate the index? Any advice
appreciated.

--
Abdul Qoyyuum Bin Haji Abdul Kadir
HP No: +673 720 8043

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2022-08-18 06:05:19 Re: Unable to Create or Drop Index Concurrently
Previous Message Ron 2022-08-18 05:53:15 Re: Setting up streaming replication on large database (20+ TB) for the first time