Re: Materialized views and unique indexes

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Materialized views and unique indexes
Date: 2013-03-08 03:42:51
Message-ID: CAB7nPqRd_LCWTZUogjrBF4a4doMTM_9viOp3BmzrE=ZwjWniqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 8, 2013 at 12:32 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
> > On 03/08/2013 10:55 AM, Michael Paquier wrote:
> >> Also, as it is not mandatory for a unique index to be a constraint, I
> >> think that we should block the creation of unique indexes too to avoid
> >> any problems. Any suggestions?
>
> > How much does the planner benefit from the implied constraint of a
> > unique index? I almost wonder if it should be allowed at the cost of
> > making the refresh of a matview that fails to comply an error.
>
> A unique constraint can allow join elimination, so I'm thinking that
> disallowing them is a bad idea (not to mention that it'd be a
> considerable wart in the code to block them for matviews only).
>
Fair argument.

The error message at refresh step should be more explicit though. I still
have the feeling that users might be lost if a constraint introduced on
matviews is failing during refresh with the current error message.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-03-08 06:07:19 Re: Enabling Checksums
Previous Message Tom Lane 2013-03-08 03:32:16 Re: Materialized views and unique indexes