Re: Join with an array

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Join with an array
Дата
Msg-id 20060223114447.GF28530@svana.org
обсуждение исходный текст
Ответ на Join with an array  (Markus Schiltknecht <markus@bluegap.ch>)
Ответы Re: Join with an array  (Markus Schiltknecht <markus@bluegap.ch>)
Список pgsql-hackers
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:
>
> CREATE TABLE lookup_table (id INT PRIMARY KEY, items INT[] NOT NULL);

<snip>

> 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 the output of EXPLAIN ANALYZE for that query. Anything
less and we're guessing. Have you got the appropriate indexes?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Martin Pitt
Дата:
Сообщение: Re: pg_config, pg_service.conf, postgresql.conf ....
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: Join with an array