Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VjuTv-0005eF-Pk for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Nov 2013 17:25:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VjuTv-0005GC-8T for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Nov 2013 17:25:27 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vj2oA-0008KO-1Q for pgsql-bugs@postgresql.org; Wed, 20 Nov 2013 08:06:46 +0000 Received: from pas002.connectel-cz.com ([77.236.207.140]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vj2o2-00010Z-7n for pgsql-bugs@postgresql.org; Wed, 20 Nov 2013 08:06:45 +0000 Received: from localhost (localhost [127.0.0.1]) by pas002.connectel-cz.com (Postfix) with ESMTP id C90C61820AF; Wed, 20 Nov 2013 09:06:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at pas002.connectel-cz.com Received: from pas002.connectel-cz.com ([127.0.0.1]) by localhost (pas002.connectel-cz.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uQxFLhgg4mm3; Wed, 20 Nov 2013 09:06:35 +0100 (CET) Received: from pan056 (unknown [77.236.207.137]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: pajare1@pas002.connectel-cz.com) by pas002.connectel-cz.com (Postfix) with ESMTPSA id 9BCCC18047D; Wed, 20 Nov 2013 09:06:35 +0100 (CET) From: "Jaroslav Rejda" To: "'Tom Lane'" , "'Kevin Grittner'" Cc: Subject: Re: BUG #8606: Materialized View WITH NO DATA bug Date: Wed, 20 Nov 2013 09:06:31 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: Ac7lo5AUb76Y+sTgQsenZehr6uP+qQAIQckg In-Reply-To: <31136.1384919378@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Message-Id: <20131120080635.C90C61820AF@pas002.connectel-cz.com> X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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]=20 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 writes: > "j.rejda@konektel.cz" wrote: >> -- this returns "after some time" (as long as normal "SELECT >> long_test(10);" >> do) >> CREATE MATERIALIZED VIEW test2 AS >> =A0=A0 SELECT long_test(10) WITH NO DATA; >>=20 >> -- 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 --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs