Re: Batch update of indexes on data loading

From: "Markus Bertheau" <mbertheau(dot)pg(at)googlemail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Batch update of indexes on data loading
Date: 2008-02-29 04:40:41
Message-ID: 684362e10802282040j4ac01d41j72465b940d8a6768@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/2/29, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> writes:
> > BTW, why REINDEX requires access exclusive lock? Read-only queries
> > are forbidden during the operation now, but I feel they are ok
> > because REINDEX only reads existing tuples. Can we do REINDEX
> > holding only shared lock on the index?
>
> No. When you commit the reindex, the old copy of the index will
> instantaneously disappear; it will not do for someone to be actively
> scanning that copy.

Can a shared lock be taken at first, and when the new index is ready,
in order to delete the old index, elevate that lock to an exclusive
one?

Markus

--
Markus Bertheau
Blog: http://www.bluetwanger.de/blog/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-02-29 05:05:45 Re: Batch update of indexes on data loading
Previous Message Andrew Dunstan 2008-02-29 04:29:01 Re: Silly Newbie question