Search Postgresql Archives

IN vs equality (was Re: odd intermittent query hanging issue)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 19, 2012 at 3:09 AM, Steve Crawford
<scrawford@xxxxxxxxxxxxxxxxxxxx> wrote:
> I also don't understand the "xcrm.channel_id in (1)" instead of
> "xcrm.channel_id = 1" unless this is a generated query and there could be
> multiple ids in that condition.

Side point from this thread. Is there ever any difference between
these two constructs? I often write code that generates queries, and I
could script it to "optimize down" to equality in the special case of
one to compare against, but generally don't bother. Normally my query
plans look equivalent, but is it less efficient in the query
optimizer? Obviously there's the readability issue, if you're
hand-writing SQL. Definitely better to be clear about what you mean.
But we script-craft SQL all the time (and it comes out (looking (like
this)) with all (the extra (parentheses) added) for safety).

ChrisA

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux