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 1pwq3s-0002jj-EK for pgsql-hackers@arkaria.postgresql.org; Wed, 10 May 2023 20:05:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pwq3r-0004hZ-4D for pgsql-hackers@arkaria.postgresql.org; Wed, 10 May 2023 20:05:19 +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 1pwq3q-0004hO-KM for pgsql-hackers@lists.postgresql.org; Wed, 10 May 2023 20:05:18 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pwq3n-001cZ5-Ny for pgsql-hackers@lists.postgresql.org; Wed, 10 May 2023 20:05:17 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-965ab8ed1c0so1259605266b.2 for ; Wed, 10 May 2023 13:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683749113; x=1686341113; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=FSsih8kXDys5iqao1Cip3UeQqnModGlwh/TQKtu0eS0=; b=Y6q7BJGeYJWF007nI1RsfMELIjWH9LFfEc5HS2cILMcMKk5gRyn28Y6N9XWUpa8uli tQIEg5jwPtRKy05CDcUXvC2xluLlbc5QMeU0KO+ddKRk1TtfHLMs+JmGKuxyyxuiSO/7 zCb/4ByanV2kWCiO1jxADk6OoiEho0+kfr2szvG+hN94ia7FwtrPNZlbe21Rlngt8tYw RbBd1egr8ix5SG6sqHNs+SgKViH8x/2jQhjBjjN7Z1alxGXU9qNl80dlCe89VUem2QEj Ly9qbGwr8QkI1tewNqi9s70Vv6QkatfYP+d+mVH0MrPzphp9bJHrfl6DeQ5lwJQw44RS dkRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683749113; x=1686341113; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=FSsih8kXDys5iqao1Cip3UeQqnModGlwh/TQKtu0eS0=; b=KidAQfNf1xjsh+QE/d8KB2JtDEv1Mc/QbpKl/vvk4qn2+YnvD4svkFP8zVra4+p2NQ AQ9u2LS3BC+bBRs5Ug27Dyd8+U5++xiNXypCTZ+nxaOGFgsqNo49m1sXUwJQXZt/spU+ qEbzOVNcF5JmDVfS8jVmjcM1DvKh85tsP2OUyget1GemL6Md9VvLcr2q7V7i6scO4n7O LXEZJM5msdkwajz1dWVzHeq1aFDbtf2meJBB7NhfsMmDQM68eGIe8l+1ZTrjJOYhRYPz fYT/qlCD5M7YRWsx/lItJ0u1fG7FB8OHN8+qaFFTfkr8uZ+02AtBiU1bUKZ5fXwdKC2A wUIA== X-Gm-Message-State: AC+VfDzb1qnGUJiaXjyKob4pBGMr++aAyR0AirSyfOSCY3zulXTYUoYp ak233f00qSdfSk+PiPnmq4+Wd9LB5jkpe9hWLIKpBecZ2WE= X-Google-Smtp-Source: ACHHUZ40hAfP2yDLnkwrPfQumslzIguw3Gg/d1y4bszxz0dfVAiskqPhRX/QBvGSDiR6G+JxgaDVIMtIxtByXeM/tOU= X-Received: by 2002:a17:907:268a:b0:94e:ea6d:fa98 with SMTP id bn10-20020a170907268a00b0094eea6dfa98mr14225010ejc.28.1683749113311; Wed, 10 May 2023 13:05:13 -0700 (PDT) MIME-Version: 1.0 From: Nikita Malakhov Date: Wed, 10 May 2023 23:04:57 +0300 Message-ID: Subject: RFI: Extending the TOAST Pointer To: pgsql-hackers , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000ca33dd05fb5c6369" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ca33dd05fb5c6369 Content-Type: text/plain; charset="UTF-8" Hi hackers! There were several discussions where the limitations of the existing TOAST pointers were mentioned [1], [2] and [3] and from time to time this topic appears in other places. We proposed a fresh approach to the TOAST mechanics in [2], but unfortunately the patch was met quite unfriendly, and after several iterations was rejected, although we still have hopes for it and have several very promising features based on it. Anyway, the old TOAST pointer is also the cause of problems like [4], and this part of the PostgreSQL screams to be revised and improved. The TOAST begins with the pointer to the externalized value - the TOAST Pointer, which is very limited in means of storing data, and all TOAST improvements require revision of this Pointer structure. So we decided to ask the community for thoughts and ideas on how to rework this pointer. The TOAST Pointer (varatt_external structure) stores 4 fields: [varlena header][<4b - original data size><4b - size in TOAST table><4b - TOAST table OID><4b - ID of chunk>] In [2] we proposed the new Custom TOAST pointer structure where main feature is extensibility: [varlena header][<2b - total size of the TOAST pointer><4b size of original data><4b - OID of algorithm used for TOASTing>] where Custom TOAST Pointer is distinguished from Regular one by va_flag field which is a part of varlena header, so new pointer format does not interfere with the old (regular) one. The first field is necessary because the Custom TOAST pointer has variable length due to the tail used for inline storage, and original value size is used by the Executor. The third field could be a subject for discussion. Thoughts? Objections? [1] [PATCH] Infinite loop while acquiring new TOAST Oid [2] Pluggable Toaster [3] [PATCH] Compression dictionaries for JSONB [4] BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table. -- Regards, Nikita Malakhov Postgres Professional The Russian Postgres Company https://postgrespro.ru/ --000000000000ca33dd05fb5c6369 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi hackers!

There were several discussi= ons where the limitations of the existing TOAST pointers
were men= tioned [1], [2] and [3] and from time to time this topic appears in other p= laces.

We proposed=C2=A0a fresh approach to the TO= AST mechanics in [2], but unfortunately the
patch=C2=A0was met qu= ite unfriendly, and after several iterations was rejected, although=C2=A0we=
still have hopes for it and have several very promising features= based on it.

Anyway, the old TOAST pointer is als= o the cause of problems like [4], and this part of
the PostgreSQL= screams to be revised and improved.

The TOAST beg= ins with the pointer to the externalized value - the TOAST Pointer, which
is very limited in means of storing data, and all TOAST improvemen= ts require revision
of this Pointer structure. So we decided to a= sk the community for thoughts and ideas on
how to rework this poi= nter.
The TOAST Pointer (varatt_external structure) stores 4 fiel= ds:
[varlena header][<4b - original data size><4b - size= in TOAST table><4b - TOAST table OID><4b - ID of chunk>]
In [2] we proposed the new Custom TOAST pointer structure where mai= n feature is
extensibility:
[varlena header][<2b - t= otal size of the TOAST pointer><4b size of original data><4b - = OID of algorithm used for TOASTing><variable length field used for st= oring any custom data>]
where Custom TOAST Pointer is distingu= ished from Regular one by va_flag field which
is a part of varlen= a header, so new pointer format does not interfere with the old (regular) o= ne.
The first field is necessary because the Custom TOAST pointer= has variable length due to the
tail used for inline storage, and= original=C2=A0value size is used by the Executor. The third field could
be a subject for discussion.

Thoughts? Obj= ections?

[4]=C2=A0BU= G #16722: PG hanging on COPY when table has close to 2^32 toasts in the tab= le.

--
Re= gards,
Nikita Malakhov
Postgres Professional
The Russian Postgres Company
--000000000000ca33dd05fb5c6369--