Re: select function alias

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "btober(at)computer(dot)org" <btober(at)broadstripe(dot)net>
Cc: 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 18:15:58
Message-ID: CAKFQuwbGdznRrPqgqFjX4T5_KgH1HcLUBMmZ-N4hVRKVhdL6gQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sinclair, Ian D (Ian) 2016-11-30 18:27:33 Re: How to migrate from PGSQL 9.3 to 9.6
Previous Message Merlin Moncure 2016-11-30 17:08:39 Re: Index is not used for "IN (non-correlated subquery)"