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 1pzdCN-0006Mt-0a for pgsql-hackers@arkaria.postgresql.org; Thu, 18 May 2023 12:57:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pzdCJ-00072n-P5 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 May 2023 12:57: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 1pzdCJ-00072e-EU for pgsql-hackers@lists.postgresql.org; Thu, 18 May 2023 12:57:35 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pzdCA-000US0-TJ for pgsql-hackers@lists.postgresql.org; Thu, 18 May 2023 12:57:34 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2532c2c419dso1544365a91.0 for ; Thu, 18 May 2023 05:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timescale.com; s=google; t=1684414645; x=1687006645; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vVMW8cHN0det1AQaJEXg/Y0oAWYgwPT5ULgfAFXTRwo=; b=iXKgp/oojkYXuzsB6Ba2WjvFeYSGHcNd/or4UhnHk2G3DTlVjJZ8IxyOtFixyYWPVJ Wo62dg0U0fs4DVR1FVslXuN34IJoGE1Ft6Dfz/iFIHReVB9gk93huCC/tk9YPWRUWBhn atlUB6EKB/6BQi4RP86d9cGlLkADgGrwXj06aErtIudH4pA8772Bo8AHJ2ugipJlMV8D vAwjySMXRKHPRgN9IHUwx9kQvSgYd1EopiJkymRmwK116YgNbyOHyJVghPHzXR6zmJL2 umL+1QmIDP5xr8TlMFl30APAf1/8qxrKOpztm7zYU8U/b0+idjDiN1LTemWtrt8Yws2v zTTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684414645; x=1687006645; 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=vVMW8cHN0det1AQaJEXg/Y0oAWYgwPT5ULgfAFXTRwo=; b=gExLxusywiy/9ZbhIFkOKMpM4tB/pEJiX0uUkZjm/EwzwAVxFcOVWKL2ONUpOhC9aM kzAIKEPzZ6DGjBc8mGknF+nMm/7rfUSj10n6MldcOvmzjkS8WlBn2ITswKK7Fv0ALs9Y kdCpWVghMfPDSSl+N2tqsAB8eAl8h2Uxg5XF2iWqdys2/L2ybanDbbaG97JbDR58wEqq BS+J997egJyhgtgeLrRJ25D0d5J/y/Lgt/Xpu5BlG77+kfw3bhqIezyhTN4Epclga8FK PUsuOQCVG85z6wOd8KtEGz+p/e0wWo+6ctth1mITLUj/gaNKp899pI2l7y5RAJtcTNYH mQrQ== X-Gm-Message-State: AC+VfDwTeGyXT/KnKSLYO4+VMRifm5CO6Nu0Pq1jnn3UI6iHscdCtVJi wB6znsrHEIRo+Ygu4BT7SGjHG6Sid1Vds2Jfvgu8Ucz9iDzacWxe6YY= X-Google-Smtp-Source: ACHHUZ4GA1KpG/adcV3W+0o0+l308LGZztHUSJdm1ciJA3iVdmKdifTjBMhEiF5SEEchSLp/SWhcUXECAnk8jDJRvxc= X-Received: by 2002:a17:90a:fa4f:b0:24d:e3dc:4b10 with SMTP id dt15-20020a17090afa4f00b0024de3dc4b10mr2678902pjb.23.1684414645655; Thu, 18 May 2023 05:57:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Aleksander Alekseev Date: Thu, 18 May 2023 15:57:14 +0300 Message-ID: Subject: Re: RFI: Extending the TOAST Pointer To: PostgreSQL Hackers Cc: Matthias van de Meent , Nikita Malakhov Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, > No, that's inaccurate. The complete on-disk representation of a varatt is > > { > uint8 va_header; /* Always 0x80 or 0x01 */ > uint8 va_tag; /* Type of datum */ > char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Type-dependent > data, for toasted values that's currently only a varatt_external */ > } varattrib_1b_e; > > With va_tag being filled with one of the vartag_external values: > > typedef enum vartag_external > { > VARTAG_INDIRECT = 1, > VARTAG_EXPANDED_RO = 2, > VARTAG_EXPANDED_RW = 3, > VARTAG_ONDISK = 18 > } vartag_external; > > This enum still has many options to go before it exceeds the maximum > of the uint8 va_tag field. Therefore, I don't think we have no disk > representations left, nor do I think we'll need to add another option > to the ToastCompressionId enum. > As an example, we can add another VARTAG option for dictionary-enabled > external toast; like what the pluggable toast patch worked on. I think > we can salvage some ideas from that patch, even if the main idea got > stuck. The problem here is that the comments are ambiguous regarding what to call "TOAST pointer" exactly. I proposed a patch for this but it was not accepted [1]. So the exact on-disk representation of a TOAST'ed value (for little-endian machines) is: 0b00000001, 18 (va_tag), (varatt_external here) Where 18 is sizeof(varatt_external) + 2, because the length includes the length of the header. I agree that va_tag can have another use. But since we are going to make varatt_external variable in size (otherwise I don't see how it could be really **extendable**) I don't think this is the right approach. Also I agree that this particular statement is incorrect: > This will allow us to extend the pointers indefinitely. varatt_external is going to be limited to 255. But it seems to be a reasonable limitation for the nearest 10-20 years or so. [1]: https://commitfest.postgresql.org/39/3820/ -- Best regards, Aleksander Alekseev