On 2012-05-18, Jon Smark <jon.smark@xxxxxxxxx> wrote: > I can think of two solutions: > > 1) "SELECT wid, data FROM widgets WHERE wid IN $targets" > 2) "SELECT wid, data FROM widgets WHERE ARRAY [wid] <@ $targets" > my testing indicates that from 1 is significantly faster than from 2 postgres (8.4) cant factor "ARRAY[wid] <@" sufficiently to see how it can use an index to help find the answer where as it can understand "wid IN" and use an index on wid to find the rows it needs. -- ⚂⚃ 100% natural -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general