from DayHai:
for each object stored in the primary table, you can compute a hash of the content of this object and save it into another table CREATE TABLE (hash text PRIMARY KEY, object_id uuid);
To check if there is a duplicate of your object, just do a SELECT * FROM hash_table where hash = xxx
That should be way faster then out current method.