Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW93m-0002E3-MI for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 01:41:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jW93l-0001Xu-Gy for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 01:41:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW93l-0001V0-4O for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 01:41:17 +0000 Received: from sonic313-10.consmr.mail.ne1.yahoo.com ([66.163.185.33]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jW93i-0004fI-Fm for pgsql-general@postgresql.org; Wed, 06 May 2020 01:41:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1588729272; bh=sIEzA2QtRF4sZp7B2L/T6TO2qfyIWaR063m78gWsf9g=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=UZUfh4uuGHmrN5691ukxo8vGwnpGfz80kdcHCEQxIhJ0nOTcv+e8Aup3O9Y+lhdYqyJzl+6zDbNkc6dXO/8OiUpf1BwX+e5UYqZNgWo8N+/9BagmODgQwgGrbZU5CtdvNcLlGB0Sovw5OqEx/qsgpGQdin4k1FpH8ak9lvQgxeTKIOxvmupPtO5dEdyUxSve/8z9J9EwQsLGNNWtMeH4SquHAccJxAaM4jtypCXe/qDglUZzRI90MZPGqYr2y9kkY/88hRB8vqVanbC4qUqV6ctMyG5aUBOS++1j7eiQ21STG2+qagGamSCbCOANIpUY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mmucytiyPVkLsY5Qd ZA5EjIn6JvmsjOW.e0dsKwVbHYcgrIhpIzQOVvFNKLvH0yRpcD5YOBgClY9GCNQMbEVYiHO75DJ5 0vSmCXDh6seVBjU4dTuY3zS5P46Lh4GR70HH1e1JHX5BQow8KF9jml_edQ8bHIwjy2ot0FXxDDdL AOuDgzltPPAUjIbEqMEGpm.2Yw9.fIEhOIQI5.tDwsccXnqoKvmDJWc33qAFSQ0iY6cRTZn6NY1S HoQwDorLKJMZ4INgrY9trBDQObRw.VzuZmN8ejwLM0dP43YwzvWuJOSBFwMWDH8GFSia1djuzOtY DrQHfL_X_xIJ_I42sROU5Kpyo8BlSAaPS8qmJfhsLzb8- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Wed, 6 May 2020 01:41:12 +0000 Date: Wed, 6 May 2020 01:41:11 +0000 (UTC) From: Virendra Kumar Reply-To: Virendra Kumar To: "David G. Johnston" Cc: Pgsql-general General Message-ID: <261047451.1963400.1588729271431@mail.yahoo.com> In-Reply-To: References: <484413316.1946041.1588727721718.ref@mail.yahoo.com> <484413316.1946041.1588727721718@mail.yahoo.com> Subject: Re: Wrong PostgreSQL Plan MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1963399_1253732143.1588729271429" X-Mailer: WebService/1.1.15756 YMailNorrin Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0 Content-Length: 7346 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_1963399_1253732143.1588729271429 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi David, Thank you for your reply! You mean when you change the date equality filter to a more recent date? - = This is correct we have faced this when we change equality filter to more r= ecent date. Will be sending explain analyze on the thread when I get that. We ran analyze many time to see if that resolves but looks like it is not b= uzzing. Also for regular analyze we don't run manually, they are all left t= o autoanalyze process. Regards,Virendra On Tuesday, May 5, 2020, 6:34:37 PM PDT, David G. Johnston wrote: =20 =20 On Tue, May 5, 2020 at 6:15 PM Virendra Kumar wrote: Optimizer is behaving little weird in the sense that for change in one filt= er You mean when you change the date equality filter to a more recent date?=C2= =A0 it is using NESTED LOOP JOIN and running for over 30 seconds whereas for o= ther filter is working fine using HASH JOIN and under mili seconds. Which means it runs to completion which means EXPLAIN ANALYZE is possible a= nd considerably more helpful. We have played little bit around default_statistics_target, sometimes it wo= rked when the setting is around 1500 other times it doesn't work even with = setting as high as 5000. Is there anything community can suggest us in reso= lving this? Given that adding more data causes the good plan to stop working I would ha= ve to say that increasing how often you run ANALYZE on the table, irrespect= ive of default_statistics_target, is probably a good thing to try. David J. =20 ------=_Part_1963399_1253732143.1588729271429 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi David,

Thank you for your reply!

= You mean when you change the date equality filter to a more recent da= te? - This is correct we have faced this when we change equality filter to = more recent date.
=

Will be sending exp= lain analyze on the thread when I get that.


We ran analyze many time to see if that= resolves but looks like it is not buzzing. Also for regular analyze we don= 't run manually, they are all left to autoanalyze process.
Regards,
Virendra<= br>

=20
=20
On Tuesday, May 5, 2020, 6:34:37 PM PDT, David G. Johns= ton <david.g.johnston@gmail.com> wrote:


On Tue, May 5, 2020 at 6:15 PM Virendra = Kumar <viru_7683@yahoo.com> wrote:
Optimizer is behaving lit= tle weird in the sense that for change in one filter

You mean when you change the date equality filter to a more rece= nt date?
 
it is using N= ESTED LOOP JOIN and running for over 30 seconds whereas for other filter is= working fine using HASH JOIN and under mili seconds.

Which means it runs to completion which means EXPLAIN ANALYZE is possi= ble and considerably more helpful.

We ha= ve played little bit around default_statistics_target, sometimes it worked = when the setting is around 1500 other times it doesn't work even with setti= ng as high as 5000. Is there anything community can suggest us in resolving= this?

Given that adding more data causes the go= od plan to stop working I would have to say that increasing how often you r= un ANALYZE on the table, irrespective of default_statistics_target, is prob= ably a good thing to try.

David J.
=

------=_Part_1963399_1253732143.1588729271429--