nested select query take too long

From: "Arsalan Zaidi" <azaidi(at)directi(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: nested select query take too long
Date: 2001-11-19 10:31:43
Message-ID: 003c01c170e5$63100320$4301a8c0@directi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

The following query takes absolutely *ages* to run. Even with just a 1000
records in each table. It seems to me that the nested query is being run for
*every* value in the dom_ns table.

SELECT DISTINCT dom_ns.domname, dom_ns.tldtype FROM dom_ns WHERE
dom_ns.domname NOT IN (SELECT domname FROM domains WHERE domname IS NOT
NULL);

Why should is this happening? I just want the nested query to run once!

Thanks in advance.

--Arsalan.

-------------------------------------------------------------------
People often hate those things which they do not know, or cannot understand.
--Ali Ibn Abi Talib (AS)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Willison 2001-11-19 10:42:42 A newbie's opinion - postgres NEEDS a Windows binary!
Previous Message Neil Zanella 2001-11-19 10:30:11 checking date format with postgresql without creating a table