Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vna27-0093hX-1C for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 10:22:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vna25-00Adf0-0Y for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 10:22:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vna24-00Adeq-1X for pgsql-hackers@lists.postgresql.org; Wed, 04 Feb 2026 10:22:48 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vna20-000000010ew-3TRF for pgsql-hackers@postgresql.org; Wed, 04 Feb 2026 10:22:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=3n363k9HPWhmH9Tg85C0IFE8J1YzgKSpmbWlu64O1KI=; b=l/7m+ujEtMrW/fIWNK0qDgRDOy cnkTxzq2OuxxNV43/TpuLTaaouLE6Iw29G2zJHv6mIhVEW05oswIvntdTluUAee+6smIYOEemGSvs EECZj6TzWJFl0haY+5p/aoDqNajs4VxfpSn8V/QzfxTVtzNLbc9JNtHBhwDJa/u6TOzVt2Ykb1rZ5 9eiRKvlVfSEXi/LnOAZlE3GHhXtSyGS87V3oa2/KZDOkFVbMPPrXvs8RDUn6jjomgQzjcMS1BqC/T YfXP+1wleNKuofOwgAWoweGY16l1TuId3ABeVnuLPKikO8XotHwDfislFjai/cFemWvTm9ErEuXZF ccu5E0MA==; Received: from [2409:11:4120:300:255a:e789:a2d3:5244] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vna1t-002NQA-28; Wed, 04 Feb 2026 10:22:39 +0000 Date: Wed, 04 Feb 2026 19:22:22 +0900 (JST) Message-Id: <20260204.192222.892684621512920290.ishii@postgresql.org> To: assam258@gmail.com Cc: jacob.champion@enterprisedb.com, david.g.johnston@gmail.com, vik@postgresfriends.org, er@xs4all.nl, peter@eisentraut.org, pgsql-hackers@postgresql.org Subject: Re: Row pattern recognition From: Tatsuo Ishii In-Reply-To: References: <20260204.090451.1095005750732720998.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:255a:e789:a2d3:5244 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Henson, > Therefore, I believe it only makes sense to add explicit initialization > for nfaStatesActive and nfaContextsActive, since these are the only two > that release_partition() also explicitly resets. That makes sense. > Adding explicit > initialization for all the cumulative statistics would be misleading, > as it might suggest they get reset somewhere (which they don't). > > ## Proposal for consistency > > For consistency with release_partition(), I can add just the two > per-partition counter initializations to ExecInitWindowAgg(): > > /* Initialize NFA free lists for row pattern matching */ > winstate->nfaContext = NULL; > winstate->nfaContextTail = NULL; > winstate->nfaContextFree = NULL; > winstate->nfaStateFree = NULL; > winstate->nfaLastProcessedRow = -1; > winstate->nfaStatesActive = 0; // Add this > winstate->nfaContextsActive = 0; // Add this > > This would make both ExecInitWindowAgg() and release_partition() > initialize the same set of per-partition NFA fields, making the code > more uniform and easier to review. The cumulative statistics fields > remain omitted in both functions, which correctly reflects that they > are never reset. > > Functionally, this change makes no difference since palloc0() already > zeros these fields, but it improves code consistency and makes the > per-partition vs. query-wide distinction clearer. > > Would you like me to include this change in the next patch? Yes, please. Best regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp