Re: IN vs EXIIST

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Re: IN vs EXIIST
Дата
Msg-id 3D898177.2070001@mega-bucks.co.jp
обсуждение исходный текст
Ответ на IN vs EXIIST  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
Bill Gribble wrote:

 >I just did this today for a query and got a 200x speedup when
 >converting from IN to EXISTS.  It's dependent on your specific query
 >exactly how to do the conversion, but generally it's just a question
of >moving a field from the "outside" to the "inside" of the subselect.

If it's not asking too much could you recommend how I could fix this
query? It's a bit more complicated than yours and I can't seem to get
the syntax right.

select distinct invoice_id from invoice_li where received='true'
AND shipped='false' AND cancelled='false'
AND
  (invoice_id not in
    (
     select distinct invoice_id from invoice_li where received='false'
AND cancelled='false'
     )
    OR ship_now='true'
    )

Sorry for the formatting ...

Jc


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

Предыдущее
От: Wim
Дата:
Сообщение: Re: [ADMIN] Still big problems with pg_dump!
Следующее
От: Jean-Christian Imbeault
Дата:
Сообщение: datetime(): Where is it in the docs?