Re: Slow Running Queries in Azure PostgreSQL

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: "Kumar, Mukesh" <MKumar(at)peabodyenergy(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow Running Queries in Azure PostgreSQL
Date: 2022-02-22 21:27:10
Message-ID: 20220222212710.GI9008@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Feb 22, 2022 at 02:11:58PM +0000, Kumar, Mukesh wrote:

> -> Hash Join (cost=6484.69..43117.63 rows=1 width=198) (actual time=155.508..820.705 rows=52841 loops=1)"
> Hash Cond: (((lms_doc_property_rights_assoc.doc_sid_c)::text = (lms_doc_propright_status_assoc.doc_sid_c)::text) AND ((lms_property_rights_base.property_sid_k)::text = (lms_doc_propright_status_assoc.property_sid_c)::text))"

Your problem seems to start here. It thinks it'll get one row but actually
gets 53k. You can join those two tables on their own to understand the problem
better. Is either or both halves of the AND estimated well ?

If both halves are individually estimated well, but estimated poorly together
with AND, then you have correlation.

Are either of those conditions redundant with the other ? Half of the AND
might be unnecessary and could be removed.

--
Justin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message ldh@laurent-hasson.com 2022-02-24 00:47:42 RE: An I/O error occurred while sending to the backend (PG 13.4)
Previous Message Kumar, Mukesh 2022-02-22 14:11:58 Slow Running Queries in Azure PostgreSQL