pgsql: Add a materialized view relations.

From: Kevin Grittner <kgrittn(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add a materialized view relations.
Date: 2013-03-04 00:25:13
Message-ID: E1UCJDN-00042x-0w@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a materialized view relations.

A materialized view has a rule just like a view and a heap and
other physical properties like a table. The rule is only used to
populate the table, references in queries refer to the
materialized data.

This is a minimal implementation, but should still be useful in
many cases. Currently data is only populated "on demand" by the
CREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW statements.
It is expected that future releases will add incremental updates
with various timings, and that a more refined concept of defining
what is "fresh" data will be developed. At some point it may even
be possible to have queries use a materialized in place of
references to underlying tables, but that requires the other
above-mentioned features to be working first.

Much of the documentation work by Robert Haas.
Review by Noah Misch, Thom Brown, Robert Haas, Marko Tiikkaja
Security review by KaiGai Kohei, with a decision on how best to
implement sepgsql still pending.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3bf3ab8c563699138be02f9dc305b7b77a724307

Modified Files
--------------
contrib/oid2name/oid2name.c | 4 +-
contrib/pg_upgrade/info.c | 2 +-
contrib/pg_upgrade/pg_upgrade.c | 4 +-
contrib/pg_upgrade/version_old_8_3.c | 3 +
contrib/pgstattuple/pgstattuple.c | 1 +
contrib/vacuumlo/vacuumlo.c | 2 +-
doc/src/sgml/catalogs.sgml | 9 +-
doc/src/sgml/func.sgml | 23 +-
doc/src/sgml/ref/allfiles.sgml | 4 +
doc/src/sgml/ref/alter_extension.sgml | 1 +
doc/src/sgml/ref/alter_materialized_view.sgml | 167 ++++
doc/src/sgml/ref/comment.sgml | 2 +
doc/src/sgml/ref/create_index.sgml | 4 +-
doc/src/sgml/ref/create_materialized_view.sgml | 154 ++++
doc/src/sgml/ref/create_table_as.sgml | 1 +
doc/src/sgml/ref/create_view.sgml | 1 +
doc/src/sgml/ref/drop_materialized_view.sgml | 114 +++
doc/src/sgml/ref/refresh_materialized_view.sgml | 113 +++
doc/src/sgml/ref/security_label.sgml | 1 +
doc/src/sgml/reference.sgml | 4 +
doc/src/sgml/rules.sgml | 200 +++++
src/backend/access/common/reloptions.c | 2 +
src/backend/access/heap/heapam.c | 9 +-
src/backend/access/heap/tuptoaster.c | 10 +-
src/backend/catalog/aclchk.c | 2 +
src/backend/catalog/dependency.c | 4 +
src/backend/catalog/heap.c | 31 +-
src/backend/catalog/objectaddress.c | 9 +
src/backend/catalog/system_views.sql | 26 +-
src/backend/catalog/toasting.c | 5 +-
src/backend/commands/Makefile | 2 +-
src/backend/commands/alter.c | 2 +
src/backend/commands/analyze.c | 9 +-
src/backend/commands/cluster.c | 18 +
src/backend/commands/comment.c | 14 +-
src/backend/commands/copy.c | 11 +
src/backend/commands/createas.c | 137 +++-
src/backend/commands/event_trigger.c | 2 +
src/backend/commands/explain.c | 35 +-
src/backend/commands/indexcmds.c | 6 +-
src/backend/commands/matview.c | 374 +++++++++
src/backend/commands/prepare.c | 2 +-
src/backend/commands/seclabel.c | 5 +-
src/backend/commands/tablecmds.c | 158 +++-
src/backend/commands/typecmds.c | 3 +-
src/backend/commands/vacuum.c | 21 +-
src/backend/commands/view.c | 68 +--
src/backend/executor/execMain.c | 80 ++
src/backend/executor/spi.c | 7 +
src/backend/nodes/copyfuncs.c | 17 +
src/backend/nodes/equalfuncs.c | 15 +
src/backend/nodes/outfuncs.c | 2 +
src/backend/nodes/readfuncs.c | 2 +
src/backend/optimizer/plan/planner.c | 2 +-
src/backend/optimizer/util/plancat.c | 1 +
src/backend/parser/analyze.c | 27 +-
src/backend/parser/gram.y | 181 +++++-
src/backend/parser/parse_utilcmd.c | 6 +
src/backend/postmaster/autovacuum.c | 22 +-
src/backend/postmaster/pgstat.c | 1 +
src/backend/rewrite/rewriteDefine.c | 7 +-
src/backend/rewrite/rewriteDefine.c.orig | 945 +++++++++++++++++++++++
src/backend/rewrite/rewriteHandler.c | 20 +-
src/backend/storage/lmgr/predicate.c | 5 +-
src/backend/tcop/dest.c | 7 +
src/backend/tcop/utility.c | 50 +-
src/backend/utils/adt/dbsize.c | 24 +
src/backend/utils/adt/xml.c | 4 +-
src/backend/utils/cache/relcache.c | 26 +
src/bin/initdb/initdb.c | 2 +-
src/bin/pg_dump/common.c | 6 +-
src/bin/pg_dump/pg_backup_archiver.c | 4 +-
src/bin/pg_dump/pg_dump.c | 419 ++++++++---
src/bin/pg_dump/pg_dump.h | 4 +-
src/bin/pg_dump/pg_dump_sort.c | 17 +-
src/bin/psql/command.c | 3 +-
src/bin/psql/describe.c | 147 +++--
src/bin/psql/help.c | 1 +
src/bin/psql/tab-complete.c | 176 ++++-
src/include/catalog/heap.h | 1 +
src/include/catalog/pg_class.h | 1 +
src/include/catalog/pg_proc.h | 2 +
src/include/commands/createas.h | 4 +
src/include/commands/explain.h | 4 +-
src/include/commands/matview.h | 28 +
src/include/commands/tablecmds.h | 2 +
src/include/commands/view.h | 2 +
src/include/executor/executor.h | 1 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/parsenodes.h | 18 +-
src/include/nodes/primnodes.h | 4 +-
src/include/parser/kwlist.h | 2 +
src/include/tcop/dest.h | 3 +-
src/include/utils/builtins.h | 1 +
src/include/utils/rel.h | 1 +
src/pl/plpgsql/src/pl_comp.c | 10 +-
src/pl/tcl/pltcl.c | 1 +
src/test/regress/expected/matview.out | 406 ++++++++++
src/test/regress/expected/rules.out | 34 +-
src/test/regress/output/misc.source | 12 +-
src/test/regress/parallel_schedule | 2 +-
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/matview.sql | 128 +++
103 files changed, 4240 insertions(+), 438 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Josh Berkus 2013-03-04 00:27:02 Re: Materialized views WIP patch
Previous Message Tom Lane 2013-03-04 00:05:58 pgsql: Get rid of any toast table when converting a table to a view.