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 1qBVCm-0007IF-D4 for pgsql-performance@arkaria.postgresql.org; Tue, 20 Jun 2023 06:51:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qBVCl-0004X3-63 for pgsql-performance@arkaria.postgresql.org; Tue, 20 Jun 2023 06:51:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBVCk-0004Wt-SA for pgsql-performance@lists.postgresql.org; Tue, 20 Jun 2023 06:51:06 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qBVCf-003ZhK-Hx for pgsql-performance@lists.postgresql.org; Tue, 20 Jun 2023 06:51:06 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-519b771f23aso5742302a12.1 for ; Mon, 19 Jun 2023 23:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1687243860; x=1689835860; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=/nkvEYTMMXzx3UeIv+pbt7ldkkxwzBfmaeOly+mJxTg=; b=UotvWMiCo+W692KhsDq6Ks7lDNXRhcWZCGnX6KwoZGgx/pahQnpedC0erRq/jA5cqH hOHWcaGQZht1nT362F/Oiv+HuatS6lI/S/l3140oUprs2x0GFTnyP6LLP2gN7cdnSQpy 4POw+59iHZQ1rXzm+ekEXDtBqdRoJbA3KN7HMsQzBYg7tVPWkYubuFi8xt1hJBlAKGHZ I3GyXZeacDpxcLOzsEzo0o8lpZ19PSedDwkaTUdEpw1X1NxOgW3wd69xybjnUH4jJ0Io bCE68R+HebouisHSBsgC+h6Oeso1RO+aB0MMQvPM4v9cfv2U4Q0vNkx3v7uAH028fnHJ hk2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687243860; x=1689835860; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/nkvEYTMMXzx3UeIv+pbt7ldkkxwzBfmaeOly+mJxTg=; b=UKMg8Dhtwp6j3wF+thJXNyLMUe8213E3KhCmOSxu+PHbxn0ekkvr3xU+zt9pgytcsw 1LJJK2tzFfvB24p9rx8ExPL0F49O1BVPaLCEeR9o8ceXrfyBxFOpdCKvlCnKUVEetXZT vDeabNLzDoMUy39w8ogZE5LzChsBzQ85Y+92oO77hddR73CLcK+mQmS9utg/V54mjwbv m4SqD9su4lC8yUbqoz8kIU2nWElfbTU8U6D8V6DZ0/jxzmX2+P6cfzZBtgH52rNT5aXa A9lvIHYGXXYGZx6dc/3mJlSEPTcUW5iTXvYw9Xei6Z/U9E+WO6uPmjJ/97ZHR9yCloA7 QeLA== X-Gm-Message-State: AC+VfDzOX15LxM5GGfMYbbLUirztOkh6XBhVvWyk7SY4HruN+CTGzUQ4 MD9Wm08yGid+IPLDCNZYOkc5cQ== X-Google-Smtp-Source: ACHHUZ7VmSZn6aBHv6PQVDBggTw691A6O0m6xDTgt9tfFo2KV8/G0d2Quc6X1yl4Z98pMLo+wCPt+A== X-Received: by 2002:aa7:d901:0:b0:518:4a5b:56a with SMTP id a1-20020aa7d901000000b005184a5b056amr7317673edr.32.1687243859845; Mon, 19 Jun 2023 23:50:59 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:536d:25c2:6fdf:bd95:83f2]) by smtp.gmail.com with ESMTPSA id m24-20020aa7c2d8000000b0051a38fdd75fsm632791edp.19.2023.06.19.23.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 23:50:59 -0700 (PDT) Message-ID: <335bca9eaf98a6865c8bfd8fc54b09caa055c7bf.camel@cybertec.at> Subject: Re: Index on (fixed size) bytea value From: Laurenz Albe To: Les , "David G. Johnston" Cc: pgsql-performance@lists.postgresql.org Date: Tue, 20 Jun 2023 08:50:58 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2023-06-20 at 08:13 +0200, Les wrote: > I'm aware of the TOAST, and how it works. I was referring to it ("I think= that it should > be as large as possible, without hitting the toast.=C2=A0") I have design= ed a separate "block" > table specifically to avoid storing binary data in the TOAST. So my plan = is not going to > involve out-of-band storage. >=20 > Just to make this very clear: a record in the block table would store a b= lock, not the > whole file. My question is to finding the optimal block size (without hit= ting the toast), > and finding the optimal hash algorithm=C2=A0for block de-duplication. Then you would ALTER the column and SET STORAGE MAIN, so that it does not e= ver use TOAST. The size limit for a row would then be 8kB minus page header minus row head= er, which should be somewhere in the vicinity of 8140 bytes. If you want your block size to be a power of two, the limit would be 4kB, w= hich would waste almost half your storage space. Yours, Laurenz Albe