Re: refresh materialized view concurrently - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: refresh materialized view concurrently
Date
Msg-id 1372881453.45768.YahooMailNeo@web162906.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: refresh materialized view concurrently  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: refresh materialized view concurrently
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Kevin Grittner <kgrittn@ymail.com> writes:

>> we acquire locks on all indexes even for a HOT UPDATE which uses
>> a seqscan, and hold those until end of transaction.  Is there a
>> reason for that?
>
> Sounds dubious to me; although in the HOT code it might be that
> there's no convenient place to release the index locks.

Further testing shows that any UPDATE or DELETE statement acquires
a RowExclusiveLock on every index on the table and holds it until
end of transaction, whether or not any rows are affected and
regardless of whether an index scan or a seqscan is used.  In fact,
just an EXPLAIN of an UPDATE or DELETE does so.  It is only INSERT
which releases the locks at the end of the statement.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] big test separation POC
Next
From: Bruce Momjian
Date:
Subject: Re: [9.4 CF 1] The Commitfest Slacker List