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 1jKGir-0003RN-6S for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2020 07:26:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKGiq-0002d2-4R for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2020 07:26:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKGip-0002Zy-Tb for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2020 07:26:35 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jKGin-0000By-NW for pgsql-hackers@postgresql.org; Fri, 03 Apr 2020 07:26:34 +0000 Received: by mail-wr1-x442.google.com with SMTP id w15so998752wrv.10 for ; Fri, 03 Apr 2020 00:26:33 -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=dPVZ0vTqO3Qa6qkwYN3YUpGXqlHInTsvKq85o/X8R+s=; b=ZD8Obss+GP70ItbN1iATOxKpiiSh1fcxpRPvTzIhSmhVYTGLTa8PTOdJvDy8KVZiHJ JKVZxbXxTEh7RJTqKOj7V/GuJRgrR4mxVorP7Zn2VXy443reMwukPW4FhtkGNNpjJ8nn uNjgZzVKJL6L02T+/ddfx22vtHmpKqOc/1tylUEy3nlyG+9M8opBeUI/68j0b71krrds cxP7BMb6dGq0XDhxN5EGkgQL9b2FPh1n9zoOvVhAOzFljjCRq0pO0dUx9yNh1+JwE7T6 8TNw3kTW+OWD9oLu9adAEBIM9FVA8ynrobEzO0Z8xEZsfQGHkvawtwahrk+Ju/wE5T1g qDRQ== 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=dPVZ0vTqO3Qa6qkwYN3YUpGXqlHInTsvKq85o/X8R+s=; b=dOz6IRTvdwvyojSZOtomfS4S1oAGXqu7TgGODUX/izm+SVTI+bY5Qkgo7kp1zYmBom zhrs1QOZR2PjJgHm6UiJxyLEuo2fxoOAJ5FPBwrzTdkuQW9/XFL+ZWp1nSZluSeTwr7P 2/vytAEAM5Rw25FfMFVtIqz04j4DQxpOX2UKvFViYSrOM0EGf+ouslQdkEULXKVANvOZ sK+AwIK4sehRVuwO+/nWLdxqPIOdPE4E1u3Vwbe3dyF15OFcK1z6h8U7LwmpmkVGGxl2 uASmvOtcoIyqO8f/oyR7cbotBgVYYdL6EiIus+bqpZv4eWkDFd1aIFgEcMJKFiyV2j9j mYkw== X-Gm-Message-State: AGi0PuZP401KqDltd2Gf5ZJtyS17j8g9uysga07+ZRf/QL6T+GhAt+ki EhYHRutDM/NKUYxg1LHaFUA= X-Google-Smtp-Source: APiQypKr+oSBqQcX4Z0ECn3dBwGiCP8RXWspguRSeZVJgyPi2vuVqDNwdwgCPH7TXOW83Q+XrLjVXg== X-Received: by 2002:adf:e48c:: with SMTP id i12mr7358434wrm.173.1585898792215; Fri, 03 Apr 2020 00:26:32 -0700 (PDT) Received: from nol (82-64-124-11.subs.proxad.net. [82.64.124.11]) by smtp.gmail.com with ESMTPSA id m8sm10061724wmc.28.2020.04.03.00.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 00:26:31 -0700 (PDT) Date: Fri, 3 Apr 2020 09:26:28 +0200 From: Julien Rouhaud To: legrand legrand Cc: pgsql-hackers@postgresql.org Subject: Re: Planning counters in pg_stat_statements (using pgss_store) Message-ID: <20200403072628.GB95652@nol> References: <8c6449d4-5fd7-f544-182b-a4bb7da1d18c@oss.nttdata.com> <20200331060307.e7kypfynz7jous62@nol> <20200331073321.bhnx2p63gp5px37f@nol> <20200331184217.tf3x534uz4vusgmp@nol> <13923268-bad9-80f9-2542-5fd5e8b8c500@oss.nttdata.com> <1585857868967-0.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585857868967-0.post@n3.nabble.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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." 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. Similarly, if a statement is successfully planned but fails during the execution phase, only its planning statistics will be displayed. Please also note that the number of planning and number of execution aren't expected to match, as the planification of a query won't always be followed by its execution and reciprocally."