Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLUPn-0004fx-P1 for pgsql-performance@arkaria.postgresql.org; Wed, 23 May 2018 14:06:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fLUPm-0003JK-EP for pgsql-performance@arkaria.postgresql.org; Wed, 23 May 2018 14:06:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLUMP-00037u-UY for pgsql-performance@lists.postgresql.org; Wed, 23 May 2018 14:03:26 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fLUMI-00024z-HK for pgsql-performance@postgresql.org; Wed, 23 May 2018 14:03:24 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 3456AD180682 for ; Wed, 23 May 2018 07:03:18 -0700 (MST) Date: Wed, 23 May 2018 07:03:18 -0700 (MST) From: pavan95 To: pgsql-performance@postgresql.org Message-ID: <1527084198212-0.post@n3.nabble.com> In-Reply-To: <20180523134322.GK30060@telsasoft.com> References: <1526883356469-0.post@n3.nabble.com> <1526917693149-0.post@n3.nabble.com> <1526985179479-0.post@n3.nabble.com> <20180522103906.GF30060@telsasoft.com> <1526986304012-0.post@n3.nabble.com> <20180522182307.GA9330@telsasoft.com> <1527058866609-0.post@n3.nabble.com> <20180523134322.GK30060@telsasoft.com> Subject: Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!! MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Justin, >How big is the table ? And curract_state_isfinal_app_idx ? >Have these been reindexed (or pg_repacked) recently? The size of the table 'tms_workflow_history' is 7600Kb(which is pretty small). Yes those indexes were dropped and recreated. >It looks like you resolved the bad estimate on the users table? Yeah, even I think the same. Please find the explain plan which got increased again vastly. Is this because of the increase in rows? Link : https://explain.depesz.com/s/Ifr The above is the explain plan taken from production server. And this is the main plan to tune. Please let me know the where I'm going wrong. Thank you in Advance.!! Regards, Pavan -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html