Re: select function alias - Mailing list pgsql-general

From Merlin Moncure
Subject Re: select function alias
Date
Msg-id CAHyXU0z-568VKOEemSW423TK5pFYxKoZBrBRHZ80hJYJW7htXw@mail.gmail.com
Whole thread Raw
In response to Re: select function alias  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On Wed, Nov 30, 2016 at 12:15 PM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> On Wed, Nov 30, 2016 at 8:15 AM, btober@computer.org
> <btober@broadstripe.net> wrote:
>>
>> 5. Use a CTE:
>>
>>     with shortnames as (
>>         select to_char(impressions_create_date,'yyyy-mm-dd') as ymd from
>> impressionsdb
>> ) select ymd from shortnames where ymd like '2016-11%';
>>
>
> Except that WHERE clause won't get pushed down (I think...haven't checked an
> explain recently) so a sub-select is definitely better in this scenario.

It's still the case FWICT.  I suspect CTE optimization fencing is
mostly considered a feature, not a bug.

merlin


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How to migrate from PGSQL 9.3 to 9.6
Next
From: "btober@computer.org"
Date:
Subject: Re: About the MONEY type