Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eE3it-0006Ue-7g for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Nov 2017 01:39:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eE3is-0007DD-N1 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Nov 2017 01:39:38 +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.84_2) (envelope-from ) id 1eE3ir-0007Ci-VR for pgsql-bugs@postgresql.org; Mon, 13 Nov 2017 01:39:38 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eE3io-0003hn-Rb for pgsql-bugs@postgresql.org; Mon, 13 Nov 2017 01:39:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAD1dRrv004672; Sun, 12 Nov 2017 20:39:28 -0500 From: Tom Lane To: Andres Freund cc: gregburek@heroku.com, pgsql-bugs@postgresql.org Subject: Re: BUG #14901: Canceled queries missing from pg_stat_statements In-reply-to: <20171112223906.dqtl3kk3pd7vn6yc@alap3.anarazel.de> References: <20171112222811.1464.28388@wrigleys.postgresql.org> <20171112223906.dqtl3kk3pd7vn6yc@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sun, 12 Nov 2017 14:39:06 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4670.1510537167.1@sss.pgh.pa.us> Date: Sun, 12 Nov 2017 20:39:27 -0500 Message-ID: <4671.1510537167@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Andres Freund writes: > On 2017-11-12 22:28:11 +0000, gregburek@heroku.com wrote: >> [ canceled queries aren't accounted for by pg_stat_statements ] > One way to address this at least partially would be to add a counter for > initiated queries and a counter for completed queries (the current > one). If all the rest of the counters are left the same the issue from > above isn't there, and you'd not even need an exception handler to > update counters. That seems like an idea well worth looking into, seeing that there's already a code path that inserts the entry into the shared table before execution starts. This would not account for queries that fail at parse or plan time, but hopefully those generally don't run long enough to be a problem. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs