Re: [GENERAL] Request to confirm which command is use for exclusive operation - Mailing list pgsql-general

From Yogesh Sharma
Subject Re: [GENERAL] Request to confirm which command is use for exclusive operation
Date
Msg-id CAEZUwCSK1JPEFwzmqQ--cG38VguQeTjpe=0SuPy4M-L=4SFhqg@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Request to confirm which command is use for exclusiveoperation  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: [GENERAL] Request to confirm which command is use for exclusive operation  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [GENERAL] Request to confirm which command is use for exclusiveoperation  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-general
Dear Albe,

Thanks for your support.

I observed there is some problem in REINDEX operation in older PostgreSQL versions.
That why i want to add explicitly lock.

Regards,
Yogesh

On Wednesday, March 8, 2017, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
Yogesh Sharma wrote:
>  I want to apply explicitly lock mechanism once inset operation is in progress then REINDEX will wait.
> And vice versa.
> So, please let me know this type of handling is possible.

Maybe I misunderstand something, but you don't need to do that because it
happens automatically.

If you run REINDEX, it will take an ACCESS EXCLUSIVE lock on the index
before it starts its work.

That means that it has to wait until all earlier INSERTing transactions are
ended, and all INSERTs that come after the REINDEX will have to wait until
the REINDEX is done.

The database takes care that the data are consistent, so why would you
want to do that explicitly?

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: hariprasath nallasamy
Date:
Subject: [GENERAL] too may LWLocks
Next
From: Vick Khera
Date:
Subject: Re: [GENERAL] import CSV file to a table