Re: BUG #8606: Materialized View WITH NO DATA bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "j(dot)rejda(at)konektel(dot)cz" <j(dot)rejda(at)konektel(dot)cz>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #8606: Materialized View WITH NO DATA bug
Date: 2013-11-20 03:49:38
Message-ID: 31136.1384919378@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> "j(dot)rejda(at)konektel(dot)cz" <j(dot)rejda(at)konektel(dot)cz> wrote:
>> -- this returns "after some time" (as long as normal "SELECT
>> long_test(10);"
>> do)
>> CREATE MATERIALIZED VIEW test2 AS
>> SELECT long_test(10) WITH NO DATA;
>>
>> -- it's ok or bug?

> It's not a bug in the sense that it crashes or returns an incorrect
> result, but it may be an opportunity for a performance enhancement.

Meh. I'm not sure this can be considered to be a problem. One of
the implications of marking a function immutable is that it has no
side-effects worthy of concern; otherwise, it wouldn't be safe for
the planner to constant-fold it, which is pretty much the whole point
of immutability. But if you're concerned about how long it takes to
evaluate, that's a kind of side effect, IMHO. Maybe it'd be better
if you marked the function VOLATILE.

But having said that, it seems that this complaint implies that
CREATE MATERIALIZED VIEW ... WITH NO DATA still runs the query
through a planning cycle. Why is that? I can't immediately see
any benefit to doing so.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jaroslav Rejda 2013-11-20 08:06:31 Re: BUG #8606: Materialized View WITH NO DATA bug
Previous Message nhajek 2013-11-20 03:07:11 BUG #8610: Duplicate records with same PK value