pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jaroslav Rejda <j.rejda@konektel.cz>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
To: 'Kevin Grittner' <kgrittn@ymail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8606: Materialized View WITH NO DATA bug
Date: Wed, 20 Nov 2013 09:06:31 +0100
Message-ID: <20131120080635.C90C61820AF@pas002.connectel-cz.com> (raw)
In-Reply-To: <31136.1384919378@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Yes, that's what I had in mind ... I expected "CREATE MATERIALIZED VIEW ...
WITH NO DATA" returns almost immediately and "REFRESH MATERIALIZED VIEW ..."
will take a while. But when you use a query that can probably be evaluated
immediately, "CREATE MATERIALIZED VIEW ... WITH NO DATA" apparently do this
query (which spends enough time), but no data is populated. The same time it
takes with "REFRESH MATERIALIZED VIEW ..." to populate data. From my
perspective, this is wrong and should behave the same for any query, ie.
"CREATE MATERIALIZED VIEW ... WITH NO DATA" would not solve the query.

JR

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Sent: Wednesday, November 20, 2013 4:50 AM
To: Kevin Grittner
Cc: j.rejda@konektel.cz; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #8606: Materialized View WITH NO DATA bug

Kevin Grittner <kgrittn@ymail.com> writes:
> "j.rejda@konektel.cz" <j.rejda@konektel.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



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (6+ messages)  latest in thread

Message-ID: <20131120080635.C90C61820AF@pas002.connectel-cz.com>
Permalink:  ../20131120080635.C90C61820AF@pas002.connectel-cz.com/
Also on:    postgresql.org/message-id/20131120080635.C90C61820AF@pas002.connectel-cz.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: j.rejda@konektel.cz, tgl@sss.pgh.pa.us, kgrittn@ymail.com
  Subject: Re: BUG #8606: Materialized View WITH NO DATA bug
  In-Reply-To: <20131120080635.C90C61820AF@pas002.connectel-cz.com>
  References: <31136.1384919378@sss.pgh.pa.us> <20131120080635.C90C61820AF@pas002.connectel-cz.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox