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 1fL4hK-0000Ns-LH for pgsql-performance@arkaria.postgresql.org; Tue, 22 May 2018 10:39:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fL4hJ-00028r-Cv for pgsql-performance@arkaria.postgresql.org; Tue, 22 May 2018 10:39:17 +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 1fL4hI-00028g-Tw for pgsql-performance@lists.postgresql.org; Tue, 22 May 2018 10:39:17 +0000 Received: from mail-it0-x22d.google.com ([2607:f8b0:4001:c0b::22d]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fL4hB-0006zK-JZ for pgsql-performance@postgresql.org; Tue, 22 May 2018 10:39:15 +0000 Received: by mail-it0-x22d.google.com with SMTP id q4-v6so24728930ite.3 for ; Tue, 22 May 2018 03:39:09 -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=IAH373AzkeWWrosyMGQA6ui876ttW9HEqPxAEBne2wY=; b=K20lj9luMY9eCaaUtzoQJzrwSXYsWXwgyGTokGlbTGUceru9c4kj/vZuOhHQrr5gIQ ufLlbIwA/oOs7C0l06bDHH1uNfG1aV3pJGXyM09UROo/Fib2hXhg/2PW97AJ5Oty4M7l aI4rd9nRKfKlJPCVvq40H0Ld+bxYq00AlSZ0MgPoVAXwf4MkDP7nZ3ETOJLXxdp6Vvtp ifg5LFNUGUHmogp2ObDmPsG+DAv/OBsnw2iwEIslfGgyfQI4hPkreR8Maauj1UqmarjQ Ld2wD4kny3lJrpBp9GxIszN/Ba1yjE0FRI+K5CXTONTseouQQf1LT+tQ4g4D8SxrpoIp H1Wg== 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=IAH373AzkeWWrosyMGQA6ui876ttW9HEqPxAEBne2wY=; b=J3YAK8BwMTMFDYb4h5H5lAVH1ZROBeax7LJekr9QUj7UXb0Zi6qJhywV47ICmfSIEJ /5lnUQDwHbGvfW1M3Rp5Q8B9wgMiuicLQrjdC0Ur/kFpFZWCMDJjXtupjAyXpZvyQqFo tRPvCP+czDIJ3z2NtYkhpX1rjRapZksn7UlZ1NEIbjXgl55DvASSL/r3LwtW7kU1RI3T 8jl0IyHsGUsMeZemuz0B0JXqkzuJk+FyE2obmRCpkhhLC2MrU03vpzdmPEsYo6j73OmA XVlEXnt/I42KFoICVGFkesn65z8QreV5ltA8YqTZRLH82W7r07f7VhFg8Ek1xmUhOChI 0sfA== X-Gm-Message-State: ALKqPweJ6SG6h5UDf5AHUPvp4Jewbdwdc5QjyFglYyTfb5/nmK++aKfP RLSgyWeiFxxu3Xg5wgNqCmqGGg== X-Google-Smtp-Source: AB8JxZph2adSkGkZWhmOl08rWERuH7HC6AcTjZG3Gqnl0BV0pYxK3zxF4jqebKqgnAMG0ryDprsJxg== X-Received: by 2002:a24:51d5:: with SMTP id s204-v6mr694244ita.151.1526985548550; Tue, 22 May 2018 03:39:08 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id n64-v6sm9285789itc.32.2018.05.22.03.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 03:39:08 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 09F34801727; Tue, 22 May 2018 05:39:06 -0500 (CDT) Date: Tue, 22 May 2018 05:39:06 -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: <20180522103906.GF30060@telsasoft.com> References: <1526883356469-0.post@n3.nabble.com> <1526917693149-0.post@n3.nabble.com> <1526985179479-0.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526985179479-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 Tue, May 22, 2018 at 03:32:59AM -0700, pavan95 wrote: > Sample query plan: > Limit (cost=92129.35..92129.63 rows=10 width=248) Would you send the output of explain(analyze,buffers) for the whole query ? And/or paste it into explain.depesz site and send a link. Justin