Re: Optimizing IN queries

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Isak Hansen" <isak(dot)hansen(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Optimizing IN queries
Date: 2008-11-10 13:53:20
Message-ID: 0F95FE61C6C244418A3FEF881B7B0287@andrusnotebook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Isak,

> 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')".

Thank you very much.
Query seems to return now immediately.

dok.dokumnr is not null
bilkaib.dokumnr can be null

I hope that modified query produces same results as original.

Andrus.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adriana Alfonzo 2008-11-10 14:00:31 Re: Importing text file into a TEXT field
Previous Message Isak Hansen 2008-11-10 13:09:13 Re: Optimizing IN queries