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 1g6Eg4-0001tF-04 for pgsql-general@arkaria.postgresql.org; Sat, 29 Sep 2018 12:48:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g6Eg1-0000WR-GB for pgsql-general@arkaria.postgresql.org; Sat, 29 Sep 2018 12:48:53 +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 1g6Eg1-0000WJ-4K for pgsql-general@lists.postgresql.org; Sat, 29 Sep 2018 12:48:53 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g6Efr-0004tQ-OQ for pgsql-general@postgresql.org; Sat, 29 Sep 2018 12:48:51 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 2ACC6F6D5E70 for ; Sat, 29 Sep 2018 05:48:42 -0700 (MST) Date: Sat, 29 Sep 2018 05:48:42 -0700 (MST) From: legrand legrand To: pgsql-general@postgresql.org Message-ID: <1538225322173-0.post@n3.nabble.com> Subject: [proposal] pg_stat_statements: extension timing instrumentation 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 Don't you have been surprised by the duration of a query (seen in psql with \timing) and the duration for the same query found in pgss ? It seems that writting the first query text to file takes some time, that high execution rate on the same query could generate waits on locks as when pgss is under pressure with too much distinct queries to store compared to the max statements allowed. All those "waits" are co-located in pgss_store function. What about adding a pgss_time counter in pgss to measure the duration of pgss_store (a guc could be added to enable/disable this) ? Knowing that there are also plans to add a planing counter in PG12, I would suggest to add plan_time, exec_time, pgss_time the sum of those 3 counters being total_time. This could help in investigating write contentions in pg_stat_statements query file, helping to define that max queries should be increased, ... A prototype is available on demand. Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html