Re: How can I optimize this query

Поиск
Список
Период
Сортировка
Искать
От
Bruno Wolff III
Тема
Re: How can I optimize this query
Дата
Msg-id
20030910031737.GA18726@wolff.to
Ответ на
How can I optimize this query (Jainendra Kumar P)
Список
Дерево обсуждения
How can I optimize this query "Jainendra Kumar P" <JAINK@infosys.com>
Re: How can I optimize this query Bruno Wolff III <bruno@wolff.to>
On Tue, Sep 09, 2003 at 13:39:10 +0530, Jainendra Kumar P  wrote:
> I have the following query
> 
> UPDATE accumulator1 SET accumulator1.status = "User Excluded"
> WHERE accumulator1.name NOT IN
> (SELECT DISTINCT accumulator1.name
>  FROM accumulator1, diaaffectedstmts
>  WHERE diaaffectedstmts.stmt like '*'+ accumulator1.name +'*' and
> diaaffectedstmts.xref_type <>  
>  "D");
> 
> How can I optimize this query?

It will probably work better in 7.4. But for now you might try replacing
NOT IN with NOT EXISTS. As long as accumulator1.name isn't going to be
NULL you should be able to rewrite the subselect to find rows where
name in the subselect matches name in the outer select.

В списке pgsql-sql по дате отправления
От: Jan Wieck
Дата:
От: Richard Sydney-Smith
Дата:
Сообщение: how to vacum
FAQ