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 1fLZx9-0003Tc-2G for pgsql-performance@arkaria.postgresql.org; Wed, 23 May 2018 20:01:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fLZx7-00044t-I7 for pgsql-performance@arkaria.postgresql.org; Wed, 23 May 2018 20:01:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLZx7-00044j-5Y for pgsql-performance@lists.postgresql.org; Wed, 23 May 2018 20:01:41 +0000 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fLZx2-0007zL-8P for pgsql-performance@postgresql.org; Wed, 23 May 2018 20:01:40 +0000 Received: by mail-it0-x241.google.com with SMTP id y189-v6so6022163itb.2 for ; Wed, 23 May 2018 13:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=C37UyoY+AZwyO+C9IuD5YhY69C+WYbf76em7f71cK2g=; b=w3DP/En51Fw1pKNS3FV3bcc533DDTp9WjT/jlpC/H0NfLXb/4hJlNXGLfb6q0jjBlH xXLlL2JSExnmwnvRhvuWrlTFK6I6hTAkSR/DTSOGCLS3+mTpZa4TCQZiEEs6oS4ALY7j jaYkJEC86zCft4bISWdh9bweJsYYVyvtRri94UbFiyO4wGnneWLILonJEncwc3SjDlNH Dtxe2A8g4lqQLeBNqF3GJlct/fg2Av08sCy4R26nmVmFtm/Xv4f9WdcquI9slH4PeVud NUvh5qs92M4hHDq6pZwUb66TMxsJsf0+DarVIVQ3ITnuNyTWl8Zce3JNkeWujVE4gC9V 4ZAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=C37UyoY+AZwyO+C9IuD5YhY69C+WYbf76em7f71cK2g=; b=ndW/pG8mFR1/GNkaCpu+K6dyCFQk1tm1sIkdCeU8R7+qBc2Cx3/B3c49dASmWNF4AE 5gcOkp9CFeuf3oqGfQsgToDiW1QBWURZvHBYSiT5mMey8+SjlyDZh6+3PLBLSb+89NgA 5jjMOgjAK3sEgXVb60bf6eqoT1i1ew9bNMwafZGFgPbLkiEXaayma4+E5XpJNKXaZOn1 XTsdk9tcFa2jYKJ7ueY5/HOBKz1o9uhUZWVN7mnTWx+K3gZ9NKXlbf7BY/rG0ccCf7xV 4+1463lwsuLaN+/5Ve2xaOmC4R3QYrv7bvKeJ66WeWqkLCYZLPHEDQuN+u05mjNuJKc7 0EgA== X-Gm-Message-State: ALKqPwemwuVElxGJiynGHgUrHy42q6ScjEnnDy+e8Skq9rCpnpAQNgAa 5tXcuPujEzN5BwWAeuh0VmjbhQ== X-Google-Smtp-Source: ADUXVKKojI5dawurdsFZh3nZ1Bws95D9uZ5Mp9i9/3Or7qsJxD9JkvawA7hrH9sfimmqkkBhi8kJCg== X-Received: by 2002:a24:79d6:: with SMTP id z205-v6mr6361438itc.91.1527105693828; Wed, 23 May 2018 13:01:33 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v20-v6sm10543644iog.59.2018.05.23.13.01.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 13:01:33 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 478028019C8; Wed, 23 May 2018 15:01:32 -0500 (CDT) Date: Wed, 23 May 2018 15:01:32 -0500 From: Justin Pryzby To: pavan95 Cc: pgsql-performance@postgresql.org Subject: Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!! Message-ID: <20180523200132.GL30060@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> <1527084198212-0.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527084198212-0.post@n3.nabble.com> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, May 23, 2018 at 07:03:18AM -0700, pavan95 wrote: > 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 That's explain without "analyze", so not very useful. There's handful of questions: On Wed, May 23, 2018 at 08:43:22AM -0500, Justin Pryzby wrote: > - postgres parameters: what are shared_buffers, work_mem, effective_cache_size ? > + https://wiki.postgresql.org/wiki/Server_Configuration > - are there other DBs/applications running on the server/VM ? > - kernel tuning (readahead, VM parameters, write cache, scheduler, THP, etc) > - server hardware (what OS? storage? RAM? filesystem?) > - how does the storage perform outside of postgres? > + something like this: /usr/sbin/bonnie++ -f -n0 -x4 -d /var/lib/pgsql Justin