From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | "Igal (at) Lucee(dot)org" <igal(at)lucee(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Using Variables in Queries |
Date: | 2017-10-19 19:35:49 |
Message-ID: | 11701.1508441749@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thu, Oct 19, 2017 at 12:14 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> FROM products,
>> (values ('red widget'::text)) consts(target)
>> WHERE similarity(target, item_name) > 0.25
>> ORDER BY target <<-> item_name
>>
>> PG 9.5 and up will flatten out cases like this to be exactly what you
>> wrote out longhand.
> Does it matter if the values expression is embedded in a CTE?
Yes, CTEs are optimization fences ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Igal @ Lucee.org | 2017-10-19 19:54:12 | Re: Using Variables in Queries |
Previous Message | David G. Johnston | 2017-10-19 19:20:43 | Re: Using Variables in Queries |