pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Kumar, Mukesh <MKumar@peabodyenergy.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow Running Queries in Azure PostgreSQL
Date: Tue, 22 Feb 2022 15:27:10 -0600
Message-ID: <20220222212710.GI9008@telsasoft.com> (raw)
In-Reply-To: <CH0P221MB0474E218EBD5515523B737EFDE3B9@CH0P221MB0474.NAMP221.PROD.OUTLOOK.COM>
References: <CH0P221MB04744A1E2BFD6F5A40FFFA57DE3B9@CH0P221MB0474.NAMP221.PROD.OUTLOOK.COM>
	<CH0P221MB0474E218EBD5515523B737EFDE3B9@CH0P221MB0474.NAMP221.PROD.OUTLOOK.COM>

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





view thread (3+ messages)  latest in thread

Message-ID: <20220222212710.GI9008@telsasoft.com>
Permalink:  ../20220222212710.GI9008@telsasoft.com/
Also on:    postgresql.org/message-id/20220222212710.GI9008@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pryzby@telsasoft.com, MKumar@peabodyenergy.com
  Subject: Re: Slow Running Queries in Azure PostgreSQL
  In-Reply-To: <20220222212710.GI9008@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox