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.

Attachment: pgp8yl4K3dTtz.pgp
Description: PGP signature

Reply via email to