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.94.2) (envelope-from ) id 1tPfEc-00EOSP-Lt for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2024 10:00:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tPfEb-009ZsF-Qa for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2024 10:00:21 +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.94.2) (envelope-from ) id 1tPfEb-009Zs6-El for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2024 10:00:21 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tPfET-001CVC-Nm for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2024 10:00:20 +0000 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-aa6b4cc7270so592263966b.0 for ; Mon, 23 Dec 2024 02:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetbrains.com; s=googleapps; t=1734948013; x=1735552813; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1j6ggeOfr4DlBCzkGq98l0g4PJVY25d1qc9RdaAbGVw=; b=a9s0QJdvDzN09tOlL6XLvcNZa7qizwUetzaCRQ99/hQR4gLlS4FplwrncllV49W6Yh SmFA2vLZyh7ORRKAw9ylJZxvuX6Q42XeB2q5hF+5gJA3pNeGWug0Vt4AEcbqwkJe86qI 9XQ1jgkwkOwCAgsLvVflLL5kwF9ge1SDauDlA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734948013; x=1735552813; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1j6ggeOfr4DlBCzkGq98l0g4PJVY25d1qc9RdaAbGVw=; b=YRrMAWTwTSKoS6s7cZm31MDizCcfjoXcdX8+tnHW8EVlSVKzF0FbLUIEf2M4dp0UwC B8HUSRMTsNUAAw7Rg2VYPN4Nj2gdn46kr5SZ+5EFdjBQ+3d7qNgVG1gv/IePqekhabBw yFY4BuaFeln5tJT/K6W1n46iNebg0NtgOr1XJmyFZTytfvKgUmj4eoWAL7PIRSSDRG2t JfvVdFrA3Hz260YOhwrLEyN5Mg1rlMeDOXJ5h+k+T7jMA5+GeSeLq/Bi7EpWkgJXv/D7 +VnS48FCe9UpyfBH+lv+ejwHVlBUzHukJuzbZZu72XNkMtKUV/obbaYex5CjQ3kXUPES /sQQ== X-Gm-Message-State: AOJu0YwxjmJmu6i9om9zya8iBhGeZYCc6kmXJnbxXc8dD3lltlIcmcnv IYbwHphnycaBgiferqy/Xa0QjPFAfMoYRO/aru9YlDkk1cI0C5Bhb8woBBsgZzR1MfuG+mVUVcy LtsFDlMcsFtNea+0IFdMDlo3qQOb9wIY3TtQobOFeasGvshQSPg== X-Gm-Gg: ASbGnctojmtENrPBdmKhldP9tqjDsfs0iNnXijYlXdIaNCp87o6n7x1cB8P9Osg/z45 j4ce7+ExWIIbsk8iBO0IkMuIsa0WRcynGkuTk X-Google-Smtp-Source: AGHT+IERQCx6y55yncVkWbACPe5uIgXvFzCAKeyk8ZfbvMbIfwunwIv6JssvRFB6udEzLk3BIhirQTedXSurhvSSZII= X-Received: by 2002:a05:6402:210f:b0:5d0:cfad:f71 with SMTP id 4fb4d7f45d1cf-5d81de1c921mr28775890a12.32.1734948012297; Mon, 23 Dec 2024 02:00:12 -0800 (PST) MIME-Version: 1.0 References: <20c3185b-ff1b-4ffe-b006-4e0ddb4e043b@cloud.gatewaynet.com> In-Reply-To: <20c3185b-ff1b-4ffe-b006-4e0ddb4e043b@cloud.gatewaynet.com> From: Ivan Shershnev Date: Mon, 23 Dec 2024 11:00:00 +0100 Message-ID: Subject: Re: Seamless age (xid) replacement To: Achilleas Mantzios - cloud Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000fab2ea0629ed0f6d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fab2ea0629ed0f6d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Got it. Thank you! On Fri, Dec 20, 2024 at 9:29=E2=80=AFAM Achilleas Mantzios - cloud < a.mantzios@cloud.gatewaynet.com> wrote: > > On 12/4/24 17:51, Ivan Shershnev wrote: > > Hello! > > > > I need to use the 'age (xid)' function, but I have noticed that it is > > deprecated without a clear alternative. I know that xid is also kinda > > deprecated, so it makes sense not to use it. I can get xid8 from > > 'pg_current_xact_id()', which replaced 'txid_current()', but cannot > > use it right away with 'age'. > > > > I can cast xid8 that I've got to xid and pass to 'age', but 1) I have > > no idea if it's the right way, i.e. it's promised to work or will work > > anyway by accident, 2) 'age' is anyway deprecated. > > > > I can re-implement 'age' by myself. It's (mostly) a subtraction after > > all. But it would mean that I inline implementation in place of "api" > > function call which is not always a great idea. > > If I am not gravely mistaken, transaction id is still (as of pgsql 17) > kept in a 32 bit int. You can checkout the source, in the docs > (https://www.postgresql.org/docs/current/routine-vacuuming.html) it > still says we are limited to the 32 bit int. Otherwise, all of a sudden > all our VACUUM troubles would have gone away, and we would see ads and > banners and flyers all over !!, so no, it is still 32 bit. > > So, you can just cast with confidence. > > Regarding pgsql system functions, some arguments, return values have > turned to xid8 others remain xid, so currently this is a mix. I guess > the goal is to go full 64 bit some time in some future version. > > > > > Could anyone advise, please? > > > > Kind regards, > > Ivan > > > --000000000000fab2ea0629ed0f6d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Got it. Thank you!

On Fri, Dec 20= , 2024 at 9:29=E2=80=AFAM Achilleas Mantzios - cloud <a.mantzios@cloud.gatewaynet.com> wr= ote:

On 12/4/24 17:51, Ivan Shershnev wrote:
> Hello!
>
> I need to use the 'age (xid)' function, but I have noticed tha= t it is
> deprecated without a clear alternative. I know that xid is also kinda =
> deprecated, so it makes sense not to use it. I can get xid8 from
> 'pg_current_xact_id()', which replaced 'txid_current()'= ;, but cannot
> use it right away with 'age'.
>
> I can cast xid8 that I've got to xid and pass to 'age', bu= t 1) I have
> no idea if it's the right way, i.e. it's promised to work or w= ill work
> anyway by accident, 2) 'age' is anyway deprecated.
>
> I can re-implement 'age' by myself. It's (mostly) a subtra= ction after
> all. But it would mean that I inline implementation in place of "= api"
> function call which is not always a great idea.

If I am not gravely mistaken, transaction id is still (as of pgsql 17)
kept in a 32 bit int. You can checkout the source, in the docs
(https://www.postgresql.org/docs/curre= nt/routine-vacuuming.html) it
still says we are limited to the 32 bit int. Otherwise, all of a sudden all our VACUUM troubles would have gone away, and we would see ads and
banners and flyers all over !!, so no, it is still 32 bit.

So, you can just cast with confidence.

Regarding pgsql system functions, some arguments, return values have
turned to xid8 others remain xid, so currently this is a mix. I guess
the goal is to go full 64 bit some time in some future version.

>
> Could anyone advise, please?
>
> Kind regards,
> Ivan


--000000000000fab2ea0629ed0f6d--