mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
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.
This commit is contained in:
@@ -19,6 +19,10 @@
|
||||
#include "tcop/dest.h"
|
||||
|
||||
|
||||
extern Query *SetupForCreateTableAs(Query *query, IntoClause *into,
|
||||
const char *queryString,
|
||||
ParamListInfo params, DestReceiver *dest);
|
||||
|
||||
extern void ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString,
|
||||
ParamListInfo params, char *completionTag);
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
|
||||
const char *queryString, ParamListInfo params);
|
||||
|
||||
extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
|
||||
ExplainState *es,
|
||||
const char *queryString, ParamListInfo params);
|
||||
ExplainState *es, const char *queryString,
|
||||
DestReceiver *dest, ParamListInfo params);
|
||||
|
||||
extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
|
||||
|
||||
|
||||
28
src/include/commands/matview.h
Normal file
28
src/include/commands/matview.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* matview.h
|
||||
* prototypes for matview.c.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/commands/matview.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef MATVIEW_H
|
||||
#define MATVIEW_H
|
||||
|
||||
#include "nodes/params.h"
|
||||
#include "tcop/dest.h"
|
||||
#include "utils/relcache.h"
|
||||
|
||||
extern void SetRelationIsScannable(Relation relation);
|
||||
|
||||
extern void ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
|
||||
ParamListInfo params, char *completionTag);
|
||||
|
||||
extern DestReceiver *CreateTransientRelDestReceiver(Oid oid);
|
||||
|
||||
#endif /* MATVIEW_H */
|
||||
@@ -78,4 +78,6 @@ extern void AtEOSubXact_on_commit_actions(bool isCommit,
|
||||
extern void RangeVarCallbackOwnsTable(const RangeVar *relation,
|
||||
Oid relId, Oid oldRelId, void *arg);
|
||||
|
||||
extern bool isQueryUsingTempRelation(Query *query);
|
||||
|
||||
#endif /* TABLECMDS_H */
|
||||
|
||||
@@ -18,4 +18,6 @@
|
||||
|
||||
extern Oid DefineView(ViewStmt *stmt, const char *queryString);
|
||||
|
||||
extern void StoreViewQuery(Oid viewOid, Query *viewParse, bool replace);
|
||||
|
||||
#endif /* VIEW_H */
|
||||
|
||||
Reference in New Issue
Block a user