Re: refresh materialized view concurrently

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refresh materialized view concurrently
Date: 2013-07-03 15:44:23
Message-ID: 20130703154423.GA2201@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-07-03 11:08:32 -0400, Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Wed, Jul 3, 2013 at 10:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Are we somehow not going through ExecOpenIndices?
>
> > I dunno. I just did a quick black-box test:
>
> > CREATE TABLE foo (a int primary key);
> > BEGIN;
> > INSERT INTO foo VALUES (1);
> > SELECT relation::regclass, locktype, mode, granted FROM pg_locks;
>
> > I get:
>
> > relation | locktype | mode | granted
> > ----------+---------------+------------------+---------
> > pg_locks | relation | AccessShareLock | t
> > foo | relation | RowExclusiveLock | t
> > | virtualxid | ExclusiveLock | t
> > | transactionid | ExclusiveLock | t
>
> > No foo_pkey anywhere.
>
> That proves nothing, as we don't keep such locks after the query
> (and there's no reason to AFAICS). See ExecCloseIndices.

Should be easy enough to test by hacking LOCK TABLE to lock indexes and
taking out a conflicting lock (SHARE?) in a second transaction. I wonder
if we shouldn't just generally allow that, I remember relaxing that
check before (when playing with CREATE/DROP CONCURRENTLY afair).

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2013-07-03 15:50:30 Re: proposal: simple date constructor from numeric values
Previous Message Robert Haas 2013-07-03 15:19:07 Re: Patch to add regression tests for SCHEMA