Skip to content

@DynamicLabels doesn't specify the node's label #2455

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

Closed
mdelmoral opened this issue Dec 2, 2021 · 1 comment
Closed

@DynamicLabels doesn't specify the node's label #2455

mdelmoral opened this issue Dec 2, 2021 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@mdelmoral
Copy link

Hi,
In a new phase of our project, we started to use @DynamicLabels annotation in the most numerous type of node we have in our database.

@Node("Player")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class PlayerNode extends UpdatableNode {

    @Nonnull
    @Id
    private String userId;

    @EqualsAndHashCode.Exclude
    @Nonnull
    @DynamicLabels
    private Set<String> labels;

....

In the DEV environment (~60k nodes), it worked great and we didn't have any problem but we deployed to PRO, the problems arose (~6.5M nodes). The performance of our DB has collapsed, even it is oversized and has plenty of hardware resources.

We started to dig in the changes that we did and fortunately, reading the current queries in execution we found out this query:

MATCH (n) WHERE (n.userId = $__id__ AND n.version = coalesce($__version__, 0)) UNWIND labels(n) AS label WITH label WHERE NOT (label IN $__staticLabels__) RETURN collect(label) AS __nodeLabels__

and this query is executed by playerNodeRepository.findById

As you can see, the MATCH(n) is searching in all nodes of our DB when it should specify the :Player node.

The difference is in our case times of 2-3 ms versus 20-30 seconds.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 2, 2021
@michael-simons michael-simons self-assigned this Dec 2, 2021
@michael-simons
Copy link
Collaborator

Thanks @mdelmoral excellent catch, will fix ASAP.

@michael-simons michael-simons added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 2, 2021
michael-simons added a commit that referenced this issue Dec 2, 2021
michael-simons added a commit that referenced this issue Dec 2, 2021
michael-simons added a commit that referenced this issue Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants