From: | wsheldah(at)lexmark(dot)com |
---|---|
To: | "Arsalan Zaidi" <azaidi(at)directi(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: nested select query take too long |
Date: | 2001-11-19 14:58:23 |
Message-ID: | 200111191458.JAA27936@interlock2.lexmark.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
What about using an outer join instead? This requires PostgreSQL 7.1 or later.
SELECT DISTINCT dom_ns.domname, dom_ns.tldtype
FROM dom_ns LEFT OUTER JOIN domains ON dom_ns.domname = domains.domname
WHERE domain.domname IS NULL;
--Wes Sheldahl
"Arsalan Zaidi" <azaidi%directi(dot)com(at)interlock(dot)lexmark(dot)com> on 11/19/2001
05:31:43 AM
To: pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: [GENERAL] nested select query take too long
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)
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= | 2001-11-19 15:58:33 | Re: Packages for RH7.2 |
Previous Message | P.J. "Josh" Rovero | 2001-11-19 13:59:02 | Re: Delete Performance |