what is less resource-intensive, WHERE id IN or INNER JOIN?

Поиск
Список
Период
Сортировка
От Miernik
Тема what is less resource-intensive, WHERE id IN or INNER JOIN?
Дата
Msg-id 20080730221158.5323.1.NOFFLE@turbacz.local
обсуждение исходный текст
Ответы Re: what is less resource-intensive, WHERE id IN or INNER JOIN?  ("Scott Carey" <scott@richrelevance.com>)
Список pgsql-performance
AFAIK, provided bar is UNIQUE in table2 (e.g. is a PRIMARY KEY) the two
queries will give the same result:

SELECT foo, id FROM table1 WHERE id IN (SELECT id FROM table2);

SELECT foo, id FROM table1 INNER JOIN table2 USING (id);

Given table1 has about 100k rows, and table2 about 100 rows, which one
should be faster, less resource intensive, use less RAM, disk access, etc?
Are there any other even better ways to acomlish the same query?

Using 8.3.3 on a 48 MB RAM Xen.

--
Miernik
http://miernik.name/

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

Предыдущее
От: Miernik
Дата:
Сообщение: Re: Database size Vs performance degradation
Следующее
От: Mark Roberts
Дата:
Сообщение: Re: Database size Vs performance degradation