Re: Invalid optimization of VOLATILE function in WHERE clause?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Florian Schoppmann <Florian(dot)Schoppmann(at)emc(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Invalid optimization of VOLATILE function in WHERE clause?
Date: 2012-09-19 18:58:42
Message-ID: CA+TgmobUsLZZ2-j9e1tDrw6csynUDTF1ZGz-cg9nVkAC1VWx4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 19, 2012 at 1:26 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> It still seems like awfully weird behavior.
>
> Why? The WHERE condition relates only to the output of the _stats
> subquery, so why shouldn't it be evaluated there, rather than after
> the join?

Because my mental model (and apparently that of the OP) is that the
WHERE clause gets evaluated separately for each row. Obviously in
many cases that can be optimized without changing the results, but not
in this case.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2012-09-19 19:39:12 Re: Invalid optimization of VOLATILE function in WHERE clause?
Previous Message Robert Haas 2012-09-19 18:53:01 Re: Removal of AcceptInvalidationMessages broke things