Re: [NEWBIE] need help optimizing this query

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: [NEWBIE] need help optimizing this query
Дата
Msg-id 20040310070317.L27998@megazone.bigpanda.com
обсуждение исходный текст
Ответ на [NEWBIE] need help optimizing this query  (Dexter Tad-y <dexterbt1@my.smart.com.ph>)
Ответы Re: [NEWBIE] need help optimizing this query  (Dexter Tad-y <dexterbt1@my.smart.com.ph>)
Список pgsql-general
On Wed, 10 Mar 2004, Dexter Tad-y wrote:

> Greetings,
> I need help in optimizing this query:
>
> select a.id, b.transaction from test as a left join pg_locks as b on
> a.xmax = b.transaction where b.transaction is null;
>
> im using the query in obtaining records not locked by other
> transactions. any help is appreciated.

It's hard to say without knowing more about the size of a and explain
analyze output.  On my 7.4 machine, using NOT IN rather than the left join
gives about a 2x speed increase on a 400k row table.

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

Предыдущее
От: Bjørn T Johansen
Дата:
Сообщение: Backup of users and group?
Следующее
От: Bjørn T Johansen
Дата:
Сообщение: Moving from 7.3.4 to 7.4.x?