Re: Materialized views WIP patch - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Materialized views WIP patch
Date
Msg-id 512F8112.3000607@vmware.com
Whole thread Raw
In response to Re: Materialized views WIP patch  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Materialized views WIP patch
List pgsql-hackers
On 28.02.2013 16:55, Robert Haas wrote:
> On Sat, Feb 23, 2013 at 8:00 AM, Michael Paquier
> <michael.paquier@gmail.com>  wrote:
>> it is. http://www.postgresql.org/docs/9.2/static/sql-reset.html
>> DISCARD would be better.
>
> Well, personally, I'm in favor of either TRUNCATE or ALTER
> MATERIALIZED VIEW ... DISCARD.  I think it's a dangerous precedent to
> suppose that we're going to start using DISCARD for things that have
> nothing to do with the existing meanings of DISCARD.  Number one, I
> think it's confusing.  Number two, it's currently possible to
> determine whether something is DDL, DML, or other by looking at the
> first word of the command.  If we throw that out the window we may
> cause performance issues for connection pooling software that tries to
> be clever like that.

FWIW, I totally agree with that. From that point of view, the best thing 
would be to tack this onto the REFRESH command, perhaps something like:

REFRESH matview INVALIDATE;
REFRESH matview UNREFRESH;
REFRESH matview DISCARD;

It's a bit weird that the command is called REFRESH, if the effect is 
the exact opposite of refreshing it. And we usually do have two separate 
commands for doing something and undoing the same; CREATE - DROP, 
PREPARE - DEALLOCATE, LISTEN - UNLISTEN, and so forth.

I think we're being too hung up on avoiding new (unreserved) keywords. 
Yes, the grammar is large because of so many keywords, but surely 
there's some better solution to that than adopt syntax that sucks. Let's 
invent a new keyword (INVALIDATE? UNREFRESH?), and deal with the grammar 
bloat separately.

- Heikki



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Materialized views WIP patch
Next
From: Jeff Janes
Date:
Subject: Building on MinGW