9.3 beta and materialized views
Hi,
I'm currently adding the support for materialized views to my SQL tool, and noticed that when creating a materialized view, a rewrite rule is also created that looks just like a rewrite rule for a "normal" view.
Using pg_get_ruledef() I see that the rule is defined like this:
REATE RULE "_RETURN" AS
ON SELECT TO matview_test DO INSTEAD
SELECT <here comes the select of the mview>
As the materialized view should be a "table" that can be selected from, I wonder what the purpose of the rewrite rule is?
Regards
Thomas
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Thomas Kellerer <spam_eater@gmx.net> writes:
I'm currently adding the support for materialized views to my SQL tool, and noticed that when creating a materialized view, a rewrite rule is also created that looks just like a rewrite rule for a "normal" view.
Yup.
As the materialized view should be a "table" that can be selected from, I wonder what the purpose of the rewrite rule is?
To store the matview's definition for use in REFRESH.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Tom Lane wrote on 16.05.2013 19:36:
As the materialized view should be a "table" that can be selected from, I wonder what the purpose of the rewrite rule is?
To store the matview's definition for use in REFRESH.
Ah, right. Makes sense.
Thanks for the quick reply.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Thomas Kellerer <spam_eater@gmx.net> wrote:
Tom Lane wrote on 16.05.2013 19:36:
As the materialized view should be a "table" that can be
selected from, I wonder what the purpose of the rewrite rule
is?To store the matview's definition for use in REFRESH.
Ah, right. Makes sense.
It will also be used to drive incremental update (in future
releases), as it does in every other product with materialized
views that I know of. In 9.3 we only got as far as explicit
REFRESH, but I hope to improve on that in 9.4.
--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general