Skip to content

@DynamicLabels generates non-parametrized query #3043

@zakjan

Description

@zakjan

@DynamicLabels generates non-parametrized query with dynamic node labels REMOVE node:<oldLabels> SET node:<newLabels> (source code).

A non-parametrized query is generated even when there is no change in the dynamic labels, e.g. REMOVE node:LabelA SET node:LabelA for a node entity with dynamic label LabelA.

When the number of dynamic labels is greater than Cypher query cache size (default 1000), this leads into a query cache overflow and causes replanning of other well-parametrized queries.

Since Neo4j 5.26, can node labels can be parametrized in this query as REMOVE node:$($oldLabels) SET node:$($newLabels)?

Node labels from @Node annotation are perfectly fine to be formatted into the query as-is (non-parametrized), as they are ensured to be constants by Java. It's only @DynamicLabels which allow any string causing this issue.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions