Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jM73V-0005nq-0f for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2020 09:31:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jM73T-0005kU-Pe for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2020 09:31:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jM73T-0005kN-GO for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2020 09:31:31 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jM73P-0007Ra-G5 for pgsql-hackers@postgresql.org; Wed, 08 Apr 2020 09:31:29 +0000 Received: by mail-lj1-x241.google.com with SMTP id r7so6818280ljg.13 for ; Wed, 08 Apr 2020 02:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SjgvWKuDBGA9aahO4m4g+plrIi+JFoZ/2WbGnzUr/es=; b=JJFwbmlEaidKVhDCc6DQVz/O/wpICJDUG6M1DWJHCSGB8+PNU1XPLJqikxaM31eUkR tKqYGrIBMkLGxRZqvajih0OQoi6T/cwnv2uiBPm/mxr9AaapfsdQEFgogVSbk0q7oIDS zVRfXzi9QkdfMcUW4dZTgaa00ezJbsbzyrVjxttUoawxS/SwncSSR9NgiILq3SikJsyE w+4BY3fX1rnv2MKsa/jq8sSeFfPJlxjOC13J363Akj9zXF6f5LuCaQeTLDuIeYw5fnHh vca7bogytX9CKrzUfbIqOCE/UyVOoQJ7YbrUO0mlMVnZ+xwy9nZ7ezujB5jPNlETCi+g gPXg== 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; bh=SjgvWKuDBGA9aahO4m4g+plrIi+JFoZ/2WbGnzUr/es=; b=pCQZul0Y+LeHpJ6UKwDXPsvXFmcWsWy8hGpf0NzyknG2ypRl8DKi9O054MkhL/MFro /642R+fy8sRNCW25qFDE4SrIhy1aCj84u3fRmOW18mc2HZW+aldwxj5yaVzePxE4e4xR uDbs33oGR4lmyrTPHRqcDm7j7FJiJLtR7vZh9Vz+tuoYeenCIZlY5goMaX/nkerI7AMr qmaOOw4rBsD4DOLdlstvawFmBFj+/01sRt+z5dFLM19mKCBfWKNmfu1lk879Xpz24ZSF Uy1T5HsC/r2dSlCUXTqU99HKtOR/pfpbZv8SUy5+D7qgW3UMIvADavP9sg9Fq50YE+vk vpEg== X-Gm-Message-State: AGi0Pub0vHWWBhfd7f70pbRU6eT+HSEUm63xYsK3kAjE6mQlZzO2H54f vYmgDvcOmMat68RPKNvAry44FZjOQZc= X-Google-Smtp-Source: APiQypKsUs8KSJN5M0OUPml/MPKhcgE9lAW6de2R0DVyco0l7CQ90osRP5C+aUQr2A6srzE5/s+jnQ== X-Received: by 2002:a2e:a549:: with SMTP id e9mr4427616ljn.28.1586338286767; Wed, 08 Apr 2020 02:31:26 -0700 (PDT) Received: from nol (82-64-124-11.subs.proxad.net. [82.64.124.11]) by smtp.gmail.com with ESMTPSA id t28sm1318071ljk.40.2020.04.08.02.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2020 02:31:25 -0700 (PDT) Date: Wed, 8 Apr 2020 11:31:20 +0200 From: Julien Rouhaud To: Fujii Masao Cc: legrand legrand , pgsql-hackers@postgresql.org Subject: Re: Planning counters in pg_stat_statements (using pgss_store) Message-ID: <20200408093120.GL1206@nol> References: <20200331060307.e7kypfynz7jous62@nol> <20200331073321.bhnx2p63gp5px37f@nol> <20200331184217.tf3x534uz4vusgmp@nol> <13923268-bad9-80f9-2542-5fd5e8b8c500@oss.nttdata.com> <1585857868967-0.post@n3.nabble.com> <20200403072628.GB95652@nol> <5c9e0ca4-c378-57aa-1b08-49c83a41d5ec@oss.nttdata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5c9e0ca4-c378-57aa-1b08-49c83a41d5ec@oss.nttdata.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Apr 08, 2020 at 05:37:27PM +0900, Fujii Masao wrote: > > > On 2020/04/03 16:26, Julien Rouhaud wrote: > > On Thu, Apr 02, 2020 at 01:04:28PM -0700, legrand legrand wrote: > > > Fujii Masao-4 wrote > > > > On 2020/04/01 18:19, Fujii Masao wrote: > > > > > > > > Finally I pushed the patch! > > > > Many thanks for all involved in this patch! > > > > > > > > As a remaining TODO item, I'm thinking that the document would need to > > > > be improved. For example, previously the query was not stored in pgss > > > > when it failed. But, in v13, if pgss_planning is enabled, such a query is > > > > stored because the planning succeeds. Without the explanation about > > > > that behavior in the document, I'm afraid that users will get confused. > > > > Thought? > > > > > > Thank you all for this work and especially to Julian for its major > > > contribution ! > > > > > > Thanks a lot to everyone! This was quite a long journey. > > > > > > > Regarding the TODO point: Yes I agree that it can be improved. > > > My proposal: > > > > > > "Note that planning and execution statistics are updated only at their > > > respective end phase, and only for successfull operations. > > > For exemple executions counters of a long running SELECT query, > > > will be updated at the execution end, without showing any progress > > > report in the interval. > > > Other exemple, if the statement is successfully planned but fails in > > > the execution phase, only its planning statistics are stored. > > > This may give uncorrelated plans vs calls informations." > > Thanks for the proposal! > > > There are numerous reasons for lack of correlation between number of planning > > and number of execution, so I'm afraid that this will give users the false > > impression that only failed execution can lead to that. > > > > Here's some enhancement on your proposal: > > > > "Note that planning and execution statistics are updated only at their > > respective end phase, and only for successful operations. > > For example the execution counters of a long running query > > will only be updated at the execution end, without showing any progress > > report before that. > > Probably since this is not the example for explaining the relationship of > planning and execution stats, it's better to explain this separately or just > drop it? > > What about the attached patch based on your proposals? > Thanks Fuji-san, it looks perfect to me!