On 2 March 2013 15:06, Kevin Grittner <kgri...@ymail.com> wrote: > [ ... ] led to > this thought: > > REFRESH MATERIALIZED VIEW name [, ...] WITH [ NO ] DATA >
[Sorry to join this discussion so late] FWIW I had a quick look at other DBs to see if there were any other precedents out there. Oracle was the only one I could find with anything similar. They use the same creation syntax: CREATE MATERIALIZED VIEW name [options] AS SELECT ... and they use ALTER for everything else, such as refreshing the MV: ALTER MATERIALIZED VIEW name REFRESH [options]; AFAICT the nearest thing they have to TRUNCATE/DISCARD is: ALTER MATERIALIZED VIEW name CONSIDER FRESH; They do also support updateable materialized views with standard DML, but it doesn't look as though they allow TRUNCATE to operate directly on a MV (although it can be made to propagate from a base table to a MV, in which case allowing TRUNCATE on the MV itself with a different meaning would likely be confusing). Oracle's MVs have lots of options, all of which hang off the 2 basic CREATE and ALTER commands. There's a certain appeal to that, rather than inventing or overloading a bunch of other commands as more options get added. The proposed REFRESH command is OK for today's options, but I think it might be overly limiting in the future. Of course, since this isn't in the SQL standard, we are free to use any syntax we like. We don't have to follow Oracle, but having a common syntax might make some people's lives easier, and I haven't seen a convincing argument as to why any alternative syntax is better. Regards, Dean -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers