Re: Simple but slow

Поиск
Список
Период
Сортировка
От Chad Thompson
Тема Re: Simple but slow
Дата
Msg-id 00ab01c249ed$3bcad2e0$32021aac@chad
обсуждение исходный текст
Ответ на Re: Simple but slow  ("Henshall, Stuart - WCP" <SHenshall@westcountrypublications.co.uk>)
Список pgsql-novice
WOW!  Thats a great query.
 
It brought down the access time from 121 secs to about 4.
 
Thanks a ton
Chad
----- Original Message -----
Sent: Thursday, August 22, 2002 7:59 AM
Subject: RE: [NOVICE] Simple but slow

> -----Original Message-----
> From: Chad Thompson [mailto:chad@weblinkservices.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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Enforcing Case
Следующее
От: "paul butler"
Дата:
Сообщение: Re: Enforcing Case