Re: index row size 2720 exceeds btree version 4

From: Albrecht Dreß <albrecht(dot)dress(at)arcor(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: index row size 2720 exceeds btree version 4
Date: 2022-08-10 08:53:39
Message-ID: G3ESHIGY.BFEFVCBJ.VO5LRTHQ@FA4CB54F.DUG4SYDN.RWGAN2WF
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter 2022-08-10 10:15:35 Re: pkg: two postgresql clients
Previous Message ml 2022-08-10 07:25:37 pkg: two postgresql clients