Re: select function alias

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "btober(at)computer(dot)org" <btober(at)broadstripe(dot)net>, Howard News <howardnews(at)selestial(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: select function alias
Date: 2016-11-30 19:21:21
Message-ID: CAHyXU0z-568VKOEemSW423TK5pFYxKoZBrBRHZ80hJYJW7htXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 30, 2016 at 12:15 PM, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Wed, Nov 30, 2016 at 8:15 AM, btober(at)computer(dot)org
> <btober(at)broadstripe(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message btober@computer.org 2016-11-30 19:23:50 Re: About the MONEY type
Previous Message Adrian Klaver 2016-11-30 18:52:15 Re: How to migrate from PGSQL 9.3 to 9.6