Re: Avoiding duplication of code via views -- slower? How do people typically do this?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Van Dyk <joe(at)tanga(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Avoiding duplication of code via views -- slower? How do people typically do this?
Date: 2013-02-15 20:31:36
Message-ID: 16227.1360960296@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joe Van Dyk <joe(at)tanga(dot)com> writes:
> On Fri, Feb 15, 2013 at 7:43 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Try without the useless "is true" bits.

> Huh, that did do the trick. Why does "is true" affect the plan?

Because "(x = y) IS TRUE" isn't the same as "x = y". (The behavior for
nulls is different.) And the planner only knows about using the latter
type of condition for indexscans. Since you need it to convert the
end_at condition into an indexscan to get a fast plan, you lose.

It's conceivable that we could teach the planner about this case, but
I haven't seen enough people doing that to make me think it's worth the
code space and planner cycles.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-02-15 21:58:43 Re: Avoiding duplication of code via views -- slower? How do people typically do this?
Previous Message Ian Harding 2013-02-15 18:36:25 Re: pg_upgrade