From: | "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk> |
---|---|
To: | 'Chad Thompson' <chad(at)weblinkservices(dot)com>, josh(at)agliodbs(dot)com, pgsql-novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Simple but slow |
Date: | 2002-08-22 13:59:02 |
Message-ID: | E2870D8CE1CCD311BAF50008C71EDE8E01F74981@MAIL_EXCHANGE |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
> -----Original Message-----
> From: Chad Thompson [mailto:chad(at)weblinkservices(dot)com]
>
> select l.id, l.full_phone into "8_21_2002"
> from "temp_list_tier" l LEFT JOIN
> (select phonenum
> from call_results_fixed
> where client_id = 8) as cr
> ON l.full_phone = cr.phonenum
> where cr.phonenum Is Null
>
I'm guessing you want all those in "temp_list_tier" where there is not the
same phone number in call_results_fixed.
Does this (untested) run better for you:
SELECT l.id,l.full_phone INTO "8_21_2002"
FROM "temp_list_tier" AS l WHERE
WHERE NOT EXISTS
(SELECT * FROM call_results_fixed AS cr
WHERE cr.client_id=8 AND l.full_phone=cr.phonenum);
Indexes needed (I think):
cr.client_id
cr.phonenum
Maybe (I don't think so):
l.full_phone
Not sure if this is what you wanted but hope its helpfull,
- Stuart
From | Date | Subject | |
---|---|---|---|
Next Message | Henshall, Stuart - WCP | 2002-08-22 14:04:24 | Re: Searching the Database |
Previous Message | Richard Ray | 2002-08-22 13:07:53 | Permissions for system tables |