Re: [PATCH] Add min() and max() aggregate functions for xid8

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Ken Kato <katouknl(at)oss(dot)nttdata(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Add min() and max() aggregate functions for xid8
Date: 2022-02-08 06:34:21
Message-ID: f983798f-3bbc-f515-6367-9b26bd1a6d9f@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/02/08 13:23, Ken Kato wrote:
>
> Thank you for the comments!
>
>> if (FullTransactionIdFollows(fxid1, fxid2))
>>     PG_RETURN_FULLTRANSACTIONID(fxid1);
>> else
>>     PG_RETURN_FULLTRANSACTIONID(fxid2);
>
>> Isn't it better to use '0xffffffffffffffff'::xid8 instead of
>> '18446744073709551615'::xid8, to more easily understand that this test
>> uses maximum number allowed as xid8?
>
> I updated these two parts as you suggested.
>
>
>> In addition to those two xid8 values, IMO it's better to insert also
>> the xid8 value neither minimum nor maximum xid8 ones, for example,
>> '42'::xid8.
>
> I added '010'::xid8, '42'::xid8, and '-1'::xid8
> in addition to '0'::xid8 and '0xffffffffffffffff'::xid8
> just to have more varieties.

Thanks for updating the patch! It basically looks good to me. I applied the following small changes to the patch. Updated version of the patch attached. Could you review this version?

+ if (FullTransactionIdFollowsOrEquals(fxid1, fxid2))
+ PG_RETURN_FULLTRANSACTIONID(fxid1);

I used FullTransactionIdFollows() and FullTransactionIdPrecedes() in xid8_larger() and xid8_smaller() because other xxx_larger() and xxx_smaller() functions also use ">" operator instead of ">=".

+create table xid8_tab (x xid8);
+insert into xid8_tab values ('0'::xid8), ('010'::xid8),
+('42'::xid8), ('0xffffffffffffffff'::xid8), ('-1'::xid8);

Since "::xid8" is not necessary here, I got rid of it from the above query.

I also merged this xid8_tab and the existing xid8_t1 table, to reduce the number of table creation.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachment Content-Type Size
min_max_aggregates_for_xid8_v4.patch text/plain 6.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton A. Melnikov 2022-02-08 07:47:18 Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Previous Message luminate 22 2022-02-08 05:12:57 I would like to participate for postgresql projects