Re: simple query running for ever

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: simple query running for ever
Дата
Msg-id 20200616220526.GK20404@telsasoft.com
обсуждение исходный текст
Ответ на simple query running for ever  (Nagaraj Raj <nagaraj.sf@yahoo.com>)
Ответы Re: simple query running for ever  (Andreas Joseph Krogh <andreas@visena.com>)
Список pgsql-performance
On Tue, Jun 16, 2020 at 08:35:31PM +0000, Nagaraj Raj wrote:
> I wrote a simple query, and it is taking too long, not sure what is wrong in it, even its not giving EXPLAIN
ANALYZE.
> 
> select T0."physical_address_sid", T0."individual_entity_proxy_id", T2."infrrd_hh_rank_nbr"
> from "cms_prospects".PROSPECT T0
> --inner join "sas_prs_tmp".DEDUPE3583E3F18 T1 on T0."individual_entity_proxy_id" = T1."individual_entity_proxy_id"
> left join "cms_prospects".INDIVIDUAL_DEMOGRAPHIC T2 on T0."individual_entity_proxy_id" =
T2."individual_entity_proxy_id"
 

Pardon me for saying so, but this query seems silly.

It's self-joining a table on its PK, which I don't think could ever be useful.

You do maybe more than 2x as much work, to get 2x as many columns, which are
all redundant.

Can't you just change 
T2."infrrd_hh_rank_nbr" to T0, and avoid the join ?

-- 
Justin



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

Предыдущее
От: Nagaraj Raj
Дата:
Сообщение: Re: simple query running for ever
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: simple query running for ever