Re: simple query running for ever

From: Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: simple query running for ever
Date: 2020-06-16 20:57:43
Message-ID: 2019958432.1888473.1592341063368@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Justin,

My apologies, I missed that.

Yes, I change work mem to 2GB but didn't see any difference. So, as your suggestion removed the distinct on pk and added a multi-column index so query planner did index-only can that is fixed the issue and query completed in 1Min.

Best regards,
Rj
On Tuesday, June 16, 2020, 01:47:21 PM PDT, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:

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.

Is this related to last week's question ?
https://www.postgresql.org/message-id/1211705382.726951.1592174752720%40mail.yahoo.com

Was that issue resolved ?

I didn't see answers to a few questions I asked there.

> 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"
>
> "Merge Left Join  (cost=55.96..18147747.08 rows=213620928 width=20)"
> "  Merge Cond: (t0.individual_entity_proxy_id = t2.individual_entity_proxy_id)"
> "  ->  Index Scan using pk_prospect on prospect t0  (cost=0.57..10831606.89 rows=213620928 width=16)"
> "  ->  Index Only Scan using indxp_individual_demo_infrrd_hh_rank_nbr on individual_demographic t2  (cost=0.57..5013756.93 rows=260652064 width=12)"
>
> Any suggestions or help would be highly appreciated.
>
> Best regards,
> Rj

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Nagaraj Raj 2020-06-16 21:13:13 Re: simple query running for ever
Previous Message Justin Pryzby 2020-06-16 20:46:59 Re: simple query running for ever