Search Postgresql Archives

Re: Optimizing IN queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 10, 2008 at 12:35 PM, Andrus <kobruleht2@xxxxxx> wrote:

> explain analyze select count(*)::INTEGER as cnt
>      from dok
>    WHERE dokumnr IN
> (869906,869907,869910,869911,869914,869915,869916,869917,869918,869921  )
> and
> dokumnr NOT IN (SELECT dokumnr FROM bilkaib WHERE
>  alusdok='LY')
>

Looks to me like most of the time is spent doing "not in (select a ton
of rows from bilkaib)".

Try something like "not exists (select null from bilkaib b where
b.dokumnr = dok.dokumnr and alusdok = 'LY')".


HTH, Isak

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux