Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j8Q0Q-0003wW-Qi for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Mar 2020 14:55:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j8Q0P-0008Ss-Bd for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Mar 2020 14:55:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j8Q0O-0008Sl-Va for pgsql-hackers@lists.postgresql.org; Sun, 01 Mar 2020 14:55:45 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1j8Q0H-0001gs-F2 for pgsql-hackers@postgresql.org; Sun, 01 Mar 2020 14:55:43 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 053141B5EA013 for ; Sun, 1 Mar 2020 07:55:36 -0700 (MST) Date: Sun, 1 Mar 2020 07:55:36 -0700 (MST) From: legrand legrand To: pgsql-hackers@postgresql.org Message-ID: <1583074536018-0.post@n3.nabble.com> In-Reply-To: References: <1578237055901-0.post@n3.nabble.com> <1578247319224-0.post@n3.nabble.com> <1582902395847-0.post@n3.nabble.com> Subject: Re: Planning counters in pg_stat_statements (using pgss_store) 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 >> I like the idea of adding a check for a non-zero queryId in the new >> pgss_planner_hook() (zero queryid shouldn't be reserved for >> utility_statements ?). > Some assert hit later, I can say that it's not always true. For > instance a CREATE TABLE AS won't run parse analysis for the underlying > query, as this has already been done for the original statement, but > will still call the planner. I'll change pgss_planner_hook to ignore > such cases, as pgss_store would otherwise think that it's a utility > statement. That'll probably incidentally fix the IVM incompatibility. Today with or without test on parse->queryId != UINT64CONST(0), CTAS is collected as a utility_statement without planning counter. This seems to me respectig the rule, not sure that this needs any new (risky) change to the actual (quite stable) patch. -- Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html