Skip site navigation (1) Skip section navigation (2)

Re: Performance of IN (...) vs. = ANY array[...]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Benjamin Minshall <minshall(at)intellicon(dot)biz>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance of IN (...) vs. = ANY array[...]
Date: 2006-09-15 20:19:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Benjamin Minshall <minshall(at)intellicon(dot)biz> writes:
> What are the advantages or disadvantages of using arrays in this 
> situation?  The = ANY array method makes plpgsql development cleaner, 
> but seems to really lack performance in certain cases.

In existing releases, the form with IN (list-of-scalar-constants)
can be optimized into indexscan(s), but = ANY (array) isn't.

8.2 will treat them equivalently (in fact, it converts IN (...) to
= ANY (ARRAY[...]) !).  So depending on your time horizon, you might
wish to stick with whichever is cleaner for your calling code.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Luke LonerganDate: 2006-09-16 23:46:04
Subject: Re: RAID 0 not as fast as expected
Previous:From: Benjamin MinshallDate: 2006-09-15 19:12:07
Subject: Performance of IN (...) vs. = ANY array[...]

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group