From: Albrecht Dreß <albrecht.dress@arcor.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: index row size 2720 exceeds btree version 4
Date: Wed, 10 Aug 2022 10:53:39 +0200
Message-ID: <G3ESHIGY.BFEFVCBJ.VO5LRTHQ@FA4CB54F.DUG4SYDN.RWGAN2WF> (raw)
In-Reply-To: <CALfOM6L9PvHBRJX-0ojdKoBXpJjU6az8Ne1x=xSFjrCbiPg4=A@mail.gmail.com>
References: <CALfOM6L9PvHBRJX-0ojdKoBXpJjU6az8Ne1x=xSFjrCbiPg4=A@mail.gmail.com>
Am 10.08.22 06:57 schrieb(en) Daulat:
> We are facing an error while uploading data in a table that has two B-tree
> indexes. As per the Postgres documentation there is a limitation of b-tree
> index size but I need to know if there is any alternative to overcome this
> issue.
[snip]
> UNIQUE INDEX uk_gvoa_gi_ad ON test.groupedvuln_asset USING btree (group_id,
> hostip, macaddress, fqdn, scanid)"
I had a similar issue, which I solved by creating an index on the hash of the concatenation of the items, i.e. something like
CREATE UNIQUE INDEX uk_gvoa_gi_ad ON test.groupedvuln_asset
USING btree (sha256(group_id::bytea || hostip::bytea || macaddress::bytea || fqdn::bytea || scanid::bytea));
Not guaranteed to be 100% collision free, though, but should be sufficient for most real-world use cases.
Hth,
Albrecht.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: albrecht.dress@arcor.de
Subject: Re: index row size 2720 exceeds btree version 4
In-Reply-To: <G3ESHIGY.BFEFVCBJ.VO5LRTHQ@FA4CB54F.DUG4SYDN.RWGAN2WF>
References: <CALfOM6L9PvHBRJX-0ojdKoBXpJjU6az8Ne1x=xSFjrCbiPg4=A@mail.gmail.com> <G3ESHIGY.BFEFVCBJ.VO5LRTHQ@FA4CB54F.DUG4SYDN.RWGAN2WF>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox