Re: Improving a simple query?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Improving a simple query?
Дата
Msg-id 49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com
обсуждение исходный текст
Ответ на Improving a simple query?  (Steve Wampler <swampler@noao.edu>)
Ответы Re: Improving a simple query?
Список pgsql-performance
> I'm not an SQL or PostgreSQL expert.
>
> I'm getting abysmal performance on a nested query and
> need some help on finding ways to improve the performance:
[snip]
>  select * from attributes_table where id in (select id from
>       attributes where (name='obsid') and (value='oid00066'));

This is the classic IN problem (much improved in 7.4 dev I believe). The
recommended approach is to rewrite the query as an EXISTS form if
possible. See the mailing list archives for plenty of examples.

Could you not rewrite this as a simple join though?

- Richard

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

Предыдущее
От: Steve Wampler
Дата:
Сообщение: Improving a simple query?
Следующее
От: "Balazs Wellisch"
Дата:
Сообщение: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL