Skip to content

feature: support ordering of uniqueness constraints #6377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ajtmccarty opened this issue Apr 29, 2025 · 0 comments
Open

feature: support ordering of uniqueness constraints #6377

ajtmccarty opened this issue Apr 29, 2025 · 0 comments
Labels
type/feature New feature or request

Comments

@ajtmccarty
Copy link
Contributor

Component

API Server / GraphQL

Describe the Feature Request

the current implementation of UniquenessChecker (the class used to determine if any nodes violate the uniqueness constraints of a given schema) runs a single cypher query that entangles all uniqueness constraints. this can cause a performance bottleneck if one of the constraints being examined has a value that many existing nodes use. for example, in the case of IP addresses, they have a uniqueness constraint of [[ip_namespace, address__value]]. Many IP address nodes might be linked to the same IP namespace, but there will only be a few nodes with the same address value.
we should refactor the UniquenessChecker and its associated cypher query to filter for each element of a uniqueness
constraint group instead of trying to handle all of the uniqueness constraint elements simultaneously. this would allow schema to specify uniqueness constraint groups from most specific to least specific (eg [address__value, ip_namespace]). then the UniquenessChecker could use that ordering to avoid checking the 1000s of nodes that might be linked to a given IP namespace and start with the address__value filtering that would yield many fewer nodes

Describe the Use Case

improve performance of the uniqueness constraints, which we need to check every time a node is created or updated

Additional Information

might require internal migration to update uniqueness constraints on some of the base schema

@ajtmccarty ajtmccarty added the type/feature New feature or request label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant