Re: Materialized views WIP patch

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Marko Tiikkaja <pgmail(at)joh(dot)to>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Materialized views WIP patch
Date: 2013-02-21 14:47:33
Message-ID: 1361458053.91387.YahooMailNeo@web162905.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Greg Stark <stark(at)mit(dot)edu> wrote:

> I actually don't really dislike using "TRUNCATE" for this
> command.  I was more asking about whether this meant people were
> thinking of the view as a thing where you could control the data
> in it by hand and could have the view be "empty" rather than just
> "not valid".

You can either populate the MV in the CREATE command or by REFRESH,
and it will be scannable.  If it is created WITH NO DATA or
TRUNCATEd it is not scannable, generating an error on an attempt to
reference it.

test=# select * from tm;
 type | totamt
------+--------
 y    |     12
 z    |     24
 x    |      5
(3 rows)

test=# truncate tm;
TRUNCATE TABLE
test=# select * from tm;
ERROR:  materialized view "tm" has not been populated
HINT:  Use the REFRESH MATERIALIZED VIEW command.

> The way I was thinking about it, whatever the command is named,
> you might be able to tell the database to drop the storage
> associated with the view but that would make the view invalid
> until it was refreshed.  It wouldn't make it appear to be empty.

I think we're on the same page after all.

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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-02-21 15:01:15 Re: Materialized views WIP patch
Previous Message Kevin Grittner 2013-02-21 14:38:57 Re: Materialized views WIP patch

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-02-21 14:53:08 Re: FDW for PostgreSQL
Previous Message Kevin Grittner 2013-02-21 14:38:57 Re: Materialized views WIP patch