Re: [GENERAL] Fetching multiple rows in single round trip

2012-05-19 Thread Jasen Betts
On 2012-05-18, Jon Smark 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

Re: [GENERAL] Fetching multiple rows in single round trip

2012-05-18 Thread David Johnston
On May 18, 2012, at 17:06, Jon Smark wrote: > Hi, > >> ...WHERE wid = ANY(string_to_array(?,';')) >> >> where the ? is a parameter that you replace with a semi-colon delimited >> listing of widget IDs >> >> Performance depends on specifics you have not provided, especially the >> expected nu

Re: [GENERAL] Fetching multiple rows in single round trip

2012-05-18 Thread Jon Smark
Hi, > ...WHERE wid = ANY(string_to_array(?,';')) > > where the ? is a parameter that you replace with a semi-colon delimited > listing of widget IDs > > Performance depends on specifics you have not provided, especially the > expected number of widgets you are going to be filtering one. Thanks

Re: [GENERAL] Fetching multiple rows in single round trip

2012-05-18 Thread David Johnston
On May 18, 2012, at 13:46, Jon Smark wrote: > Dear postgresql-general, > > What would be the best way to fetch in a single round trip a set of table > rows? > To clarify, suppose I have a 'widgets' table with columns 'wid' and 'data', > and I wish to retrieve all rows that belong to the client