Re: [HACKERS] Join with an array

2006-02-23 Thread Tom Lane
Markus Schiltknecht <[EMAIL PROTECTED]> writes: > I'm trying to speed up a query with a lookup table. This lookup table > gets very big and should still fit into memory. It does not change very > often. Given these facts I decided to use an array, as follows: > CREATE TABLE lookup_table (id INT PR

Re: [HACKERS] Join with an array

2006-02-23 Thread Markus Schiltknecht
Hello Oleg, On Thu, 2006-02-23 at 15:02 +0300, Oleg Bartunov wrote: > have you seen contrib/intarray ? Yes, but in the documentation I did not find anything like 'generate_series' or thelike. Maybe I'm looking at the wrong place, please give me a hint. Regards Markus

Re: [HACKERS] Join with an array

2006-02-23 Thread Markus Schiltknecht
Hello Martijn, On Thu, 2006-02-23 at 12:44 +0100, Martijn van Oosterhout wrote: > > SELECT i.id, i.title FROM item i > > JOIN lookup_table lut ON i.id = ANY(lut.items) > > WHERE lut.id = $LOOKUP_ID; > > At the very least you're going to have to tell us which version you are > running plus

Re: [HACKERS] Join with an array

2006-02-23 Thread Oleg Bartunov
Markus, have you seen contrib/intarray ? Oleg On Thu, 23 Feb 2006, Markus Schiltknecht wrote: Hi, I'm trying to speed up a query with a lookup table. This lookup table gets very big and should still fit into memory. It does not change very often. Given these facts I decided to use an

Re: [HACKERS] Join with an array

2006-02-23 Thread Martijn van Oosterhout
On Thu, Feb 23, 2006 at 12:36:35PM +0100, Markus Schiltknecht wrote: > Hi, > > I'm trying to speed up a query with a lookup table. This lookup table > gets very big and should still fit into memory. It does not change very > often. Given these facts I decided to use an array, as follows: > > CREA

[HACKERS] Join with an array

2006-02-23 Thread Markus Schiltknecht
Hi, I'm trying to speed up a query with a lookup table. This lookup table gets very big and should still fit into memory. It does not change very often. Given these facts I decided to use an array, as follows: CREATE TABLE lookup_table (id INT PRIMARY KEY, items INT[] NOT NULL); I know this is n