Re: Repeat execution of stable expressions

From: Peter van Hardenberg <pvh(at)pvh(dot)ca>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Repeat execution of stable expressions
Date: 2012-03-06 00:41:39
Message-ID: CAAcg=kX-fhq2vUmNPQHDcD9fA9ciN=X__SkT6MtueXFXNXAUtw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Mar 5, 2012 at 3:15 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> I've complained many times that
> select (f()).*;
>
> will execute f() once for each returned field of f() since the server
> essentially expands that into:
>
> select f().a, f().b;
>

oh, this is why we expand rows inside a WITH statement.

it should probably be fixed, but you should find something like

WITH fn AS SELECT f(),
SELECT (fn).a, (fn).b

will make your life better

--
Peter van Hardenberg
San Francisco, California
"Everything was beautiful, and nothing hurt." -- Kurt Vonnegut

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Yeb Havinga 2012-03-06 08:17:06 Re: SSD and RAID
Previous Message Merlin Moncure 2012-03-05 23:15:39 Repeat execution of stable expressions