9.3 beta and materialized views
9.3 beta and materialized views
От:
Thomas Kellerer <spam_eater@gmx.net>
Дата:
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
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
Re: 9.3 beta and materialized views
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Thomas Kellerer 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
Re: 9.3 beta and materialized views
От:
Thomas Kellerer <spam_eater@gmx.net>
Дата:
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.
Re: 9.3 beta and materialized views
От:
Kevin Grittner <kgrittn@ymail.com>
Дата:
Thomas Kellerer 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