Skip to content

add indexes and constraints content #36

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

Merged

Conversation

AlexicaWright
Copy link
Contributor

No description provided.


Note that you can also add constraints to your data to ensure uniqueness for example.
Adding constraints automatically adds a correpsonding index.
See link:https://neo4j.com/docs/cypher-manual/current/constraints/[Cypher Manual -> Constraints] for more information.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to add a ^ to the hyperlink to open in a new window?

e.g.

https://neo4j.com/docs/cypher-manual/current/constraints/[Cypher Manual -> Constraints^]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right! I'll amend! Thanks!

@AlexicaWright AlexicaWright merged commit 0f967b6 into neo4j-graph-examples:main May 15, 2024
@@ -35,9 +35,6 @@ image::movie-model.png[]

[source,cypher]
----
CREATE CONSTRAINT movie_title IF NOT EXISTS FOR (m:Movie) REQUIRE m.title IS UNIQUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't change it, it needs to stay here. other wise the performance will be affected as each MERGE needs to do a full label-scan to find the relevant nodes.

@@ -702,6 +699,22 @@ MATCH path = (person)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d)
RETURN path;
----

To aid query performance, you can add indexes to your data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either move this to the beginning, but we should ensure that people execute this cypher-block, or keep it in the MERGE statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants