Re: index row size 2720 exceeds btree version 4 - Mailing list pgsql-general

From Albrecht Dreß
Subject Re: index row size 2720 exceeds btree version 4
Date
Msg-id G3ESHIGY.BFEFVCBJ.VO5LRTHQ@FA4CB54F.DUG4SYDN.RWGAN2WF
Whole thread Raw
In response to index row size 2720 exceeds btree version 4  (Daulat <daulat.dba@gmail.com>)
List 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.
somethinglike 

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.

Attachment

pgsql-general by date:

Previous
From: ml@ft-c.de
Date:
Subject: pkg: two postgresql clients
Next
From: Peter
Date:
Subject: Re: pkg: two postgresql clients