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 1nG0Xl-0006VZ-3Y for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Feb 2022 15:30: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 1nG0Xj-0002WR-Nk for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Feb 2022 15:30:35 +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 1nG0Xj-0002WH-ES for pgsql-hackers@lists.postgresql.org; Fri, 04 Feb 2022 15:30:35 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nG0Xf-0001QM-Fj for pgsql-hackers@lists.postgresql.org; Fri, 04 Feb 2022 15:30:34 +0000 Received: from [192.168.11.9] (p2019072-ipbf2307funabasi.chiba.ocn.ne.jp [122.30.130.72]) by oss.nttdata.com (Postfix) with ESMTPSA id 7C28F604CB; Sat, 5 Feb 2022 00:30:27 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.5 at oss.nttdata.com Message-ID: <69d9da54-7066-dcc2-5efd-5fdad139bc40@oss.nttdata.com> Date: Sat, 5 Feb 2022 00:30:26 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH] Add min() and max() aggregate functions for xid8 Content-Language: en-US To: Ken Kato , pgsql-hackers@lists.postgresql.org References: <47d77b18c44f87f8222c4c7a3e2dee6b@oss.nttdata.com> From: Fujii Masao In-Reply-To: <47d77b18c44f87f8222c4c7a3e2dee6b@oss.nttdata.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022/02/03 16:45, Ken Kato wrote: > Hi hackers, > > Unlike xid, xid8 increases monotonically and cannot be reused. > This trait makes it possible to support min() and max() aggregate functions for xid8. > I thought they would be useful for monitoring. > > So I made a patch for this. Thanks for the patch! +1 with this feature. + PG_RETURN_FULLTRANSACTIONID((U64FromFullTransactionId(fxid1) > U64FromFullTransactionId(fxid2)) ? fxid1 : fxid2); Shouldn't we use FullTransactionIdFollows() to compare those two fxid values here, instead? + PG_RETURN_FULLTRANSACTIONID((U64FromFullTransactionId(fxid1) < U64FromFullTransactionId(fxid2)) ? fxid1 : fxid2); Shouldn't we use FullTransactionIdPrecedes() to compare those two fxid values here, instead? Could you add the regression tests for those min() and max() functions for xid8? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION