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.96) (envelope-from ) id 1w7M4k-005DRb-09 for pgsql-docs@arkaria.postgresql.org; Mon, 30 Mar 2026 23:31:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7M4i-0077XA-0Z for pgsql-docs@arkaria.postgresql.org; Mon, 30 Mar 2026 23:31:16 +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.96) (envelope-from ) id 1w7M4h-0077X2-1x for pgsql-docs@lists.postgresql.org; Mon, 30 Mar 2026 23:31:16 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7M4b-000000024tD-3e9U for pgsql-docs@lists.postgresql.org; Mon, 30 Mar 2026 23:31:15 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7d77b179b52so4924179a34.2 for ; Mon, 30 Mar 2026 16:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774913468; cv=none; d=google.com; s=arc-20240605; b=k0suDh7aCet/22GuZWS1bmKoRDghL971hj/hpEmtYeqKM+ld4ni6Nmt3CN8TdK2t62 52YkbQ0KuNl1IO1bb2WTT5/CXZ/3jtYgcW3jjOBxx4gZ0PbP2IgbgEN33Nxoq/8CPplB v8iZrmHIMcfKG9HLe+bwLgjMdUClEcb0ml5tJNWBRpyao3pj0cy3UkGKw/Yd4Y+IBiXK /Fq3f9kEHMahYYyB2Wns4zCcB9xF0O6qHzxZud6Svr7RrT/FxRu9crLqa5q61GNoCjAH DE1DjnmWT+nn0aLsKWnzw28icb9KBX9v3cZEtO8qG2zQR9uIq3eoArZgpusDe9T3aVcT 1Xmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bBC5nQwYNa990ix13AGrXacnkiXlRnPRF1GjjXcV4+0=; fh=IcOhHDXCdlw4DyxBwOBcqB+zZXBxSViYxMBGR5hmwqo=; b=WQuAVggKSia5KEVc7tl86durzRBQOO3NdHZeEliJv2mB4fNSVToACMFGOqqvaxBKaR G2pkRCXUs3zuJZtbr8YpS7jpchndVM13sCpLB+DfpVpfPGt4UmS3OW6noqKmVUCxyKTJ Kt9yTEqwAHS/W4Gz55h5eOvUWlqONON9v2OgfRV85sJkoRSz26BClXDRJe9p7VNlUxfW N0vHiwl2GBsuSFaY967zPP/7qVyYVPhvTex64GNdclYCkaZBSU2BzIBLhy1k9XeJo2SL a6cE3ao9rEMF/68pKYcpb9Lbc1nU9eWjaprp0WZtgoIJz5URnGKd6rEHlkdY5Nklo3Mz fyfg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1774913468; x=1775518268; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bBC5nQwYNa990ix13AGrXacnkiXlRnPRF1GjjXcV4+0=; b=12DsuiNWZLpKoq3Yabe1HugV9K+r11iN7hUnPQ/oqXeoOVJexztWEfCFx0aVLesdmQ e9sLtZRjML7RcUbtbjyWqSZnM4qFV9KRtxGxUeS7NENN18vfZfO6l85I8JhrTamYALGj uvhKQIQynFTJ9meiUGzuGXCow1oBPx/QtD9XikY5whuimVXwRVVSiirEDKsYVwqel4aw 6NUXkrUFDIaKBs3V6xBZxdSH3YlFbvstDFB7VgAHcyH5Bymj9nz11f57OZH469VMQ6e9 AscM1BEmjxYO9mWSakzHPyceuKOe7wUfaJ0rHSraIereOd8o3vEzc/O0wQMcnIxLG+Z5 2Cog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774913468; x=1775518268; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bBC5nQwYNa990ix13AGrXacnkiXlRnPRF1GjjXcV4+0=; b=Pvh14FkvkryLP1/suIIJdwXYV7t0ovrVFysVFtyrdz+kh7loOXnREm7jWZahvVlOI9 DvMdLTxaIoB1+H73dNxrN1MwxvyKSRhufIPtN+clDlogLAxwKWX/8ZfJ0hA5B/YayOQM fRJ+0+968o+g7pdRkax0pECS6CZkE+00JdudFSEjK9zMRcXUhW9GSoh7IExQIKXtSjNY TbqIc0gbmYlZ5zIamxqEwe4ZcecrpgjEctiY5ClW9WVp1Jd1Nn86F8mO4U35HES8gSIp sDNIo9/RIm2QsxspeeSE5fUppsXFFgMKcP/zt2QguSRyUkFOuW2RwQKuaTM5o4FAq+Xn mqlw== X-Gm-Message-State: AOJu0YzGGPVSHjFTkOAqlh1NrDWiQvlke//upUDHqHMD93T3dZLkDalz myEuHmH3lirTLTOSbqvFVTWigsBX/CUojqlug7iMAnXO+J4gKVPFgzNycb7INDmyhb5Xqdvvk4S +Xolg1mcN5Mm8ds14ldq/vgUCFc6fesj/PhV4111PfQ== X-Gm-Gg: ATEYQzzIX+pVJjKBG3DiVGfmlEeuUWqNnkNPWL+iI8AaMMT6lAuFoIH8xa4W0hjCvtB kWsdy2+x5uxNFGmyoFzZLzq5pzRug++Iq82K80EFLxw9mqiiquUwSfHZCNtxMHH918j5Ezm23MU xydgt+Ip4Tvba6YDi1me52ebWDOpKwg6tjEbhlM2v/dHtm6DyWLJ38SFdk21+zLjD/nNmyPy7WC uY414FhWmJ6L5nWjzvKElMzXShbjy2iWmivwv8b82G1v8wGXtAfJVSwLB8j1CH0+P57s8pB8nMo Q3d7fNg5 X-Received: by 2002:a05:6820:629:b0:67e:15c2:9d85 with SMTP id 006d021491bc7-67e186330f1mr8037344eaf.21.1774913468054; Mon, 30 Mar 2026 16:31:08 -0700 (PDT) MIME-Version: 1.0 References: <1855968.1774812758@sss.pgh.pa.us> <2581763.1774908361@sss.pgh.pa.us> In-Reply-To: <2581763.1774908361@sss.pgh.pa.us> From: Paul A Jungwirth Date: Mon, 30 Mar 2026 16:30:57 -0700 X-Gm-Features: AQROBzAlxg3BfeQMvXDZW87eTwbjbucwUjYW7fFGN8C_3SnRfaPE9Q2o59I7CHM Message-ID: Subject: Re: Correct docs about GiST leaf page structure To: Tom Lane Cc: pgsql-docs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 30, 2026 at 3:06=E2=80=AFPM Tom Lane wrote: > > Paul A Jungwirth writes: > > On Sun, Mar 29, 2026 at 12:32=E2=80=AFPM Tom Lane w= rote: > >> Actually I think it's more complicated than that. A GiST opclass > >> can choose whether to compress leaf-key entries, and if it does it > >> can use a different representation than it does on internal pages. > >> You can see that in action in compress/decompress functions that > >> pay attention to the GISTENTRY.leafkey flag, which many do. > > > I think your changes are great. I agree about not needing two commits. > > My only hesitation is removing the line about STORAGE. In btree_gist > > we do declare the storage of many opclasses. But I'm not sure why. Is > > it necessary? Does an opclass gain some advantage from it? Does core > > use that information somehow? Especially if leaf keys might or might > > not be the same type as internal keys, I'm not sure what value > > declaring STORAGE can provide. (It must be for core's sake, not the > > opclass's, right?) > > Excellent questions, and thanks for holding my feet to the fire about > that ;-). Reading more closely, the STORAGE option does indeed do > something: it determines the declared data type of the index's column, > as stored in pg_attribute. And that's important because GiST uses > that datatype while forming or deforming index tuples. So it has to > be accurate --- but only to the extent of having the right > typlen/typbyval/typalign properties, because that's as much as > index_form_tuple() and related functions really care about. They > don't look into the contents of the entries, except for the length > word if it's typlen -1. > > My claim that the leaf key representation can be different from upper > levels is still accurate, but both representations have to match the > typlen/typbyval/typalign properties of whatever type is mentioned > in STORAGE. (I was misled by the fact that the GiST code has > different "leafTupdesc" and "nonLeafTupdesc" tuple descriptors. > But leafTupdesc is just the standard rd_att descriptor made from > the index's pg_attribute entries, and nonLeafTupdesc differs from > it only in having removed any INCLUDE attributes.) > > So here's a v3 that accounts for that. I also decided that we were > going in quite the wrong direction by cramming more info into the > summary paragraph early in gist.sgml. The general plan there is to > offer about a one-sentence description of each opclass method, and > then go into more detail as necessary in the per-method text below. > So I moved all this info down into the compress method's section. > This seems to me to read noticeably better. I appreciate the explanation! Your v3 text has a lot of good info. I like i= t. --=20 Paul ~{:-) pj@illuminatedcomputing.com