Re: Fetching multiple rows in single round trip - Mailing list pgsql-general

From Jasen Betts
Subject Re: Fetching multiple rows in single round trip
Date
Msg-id jp83oa$g73$1@reversiblemaps.ath.cx
Whole thread Raw
In response to Fetching multiple rows in single round trip  (Jon Smark <jon.smark@yahoo.com>)
List pgsql-general
On 2012-05-18, Jon Smark <jon.smark@yahoo.com> 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

pgsql-general by date:

Previous
From: "John Watts"
Date:
Subject: Re: difference in query plan when db is restored
Next
From: "John Watts"
Date:
Subject: Re: difference in query plan when db is restored