| От | 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" <JAINK@infosys.com>) |
| Список | pgsql-sql |
On Tue, Sep 09, 2003 at 13:39:10 +0530, Jainendra Kumar P <JAINK@infosys.com> 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера