subql
subql copied to clipboard
@index(unique: true) and historical should have exclusion constraints set.
Description
This is a follow up issue to https://github.com/subquery/subql/issues/1518. When historical is enabled and @index(unique: true)
is set on an entity field a GiST index is used with _block_height
. But GiST doesn't support unique indexes so the fields on this entity will not be unique.
We should set exclusion constraints on the table to enforce the uniqueness
I think unique
index doesn't offer more efficiency than a normal index, so we can safely say it is for fool-proofing.
In that case, we can ignore unique:true
or refuse it. I'm worried more exclusion constraints
will have performance impact.