-
Notifications
You must be signed in to change notification settings - Fork 41
Review of the page Defining a schema #512
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
base: dev
Are you sure you want to change the base?
Conversation
AlexicaWright
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also very useful! Left some comments!
| = Defining a schema | ||
|
|
||
| This guide explains how to define a schema by using indexes and constraints. | ||
| While Neo4j is often described as _schema optional_, indexes and constraints can be introduced when desired, in order to gain performance or xref:data-modeling/index.adoc[modeling] benefits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| While Neo4j is often described as _schema optional_, indexes and constraints can be introduced when desired, in order to gain performance or xref:data-modeling/index.adoc[modeling] benefits. | |
| While Neo4j is often described as _schema optional_, indexes and constraints can be added when needed, either for performance optimization or xref:data-modeling/index.adoc[modeling] benefits. |
I don't really understand what modelling has to do with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure either, it's from the original content. Should we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, it IS related. Maybe it can be rephrased to make it clearer?
| == Example graph | ||
|
|
||
| First create some data to use for our examples: | ||
| After you create a link:https://neo4j.com/product/auradb/?ref=docs-nav-get-started[free Aura instance], use the "Connect" button and select "Query". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does read a bit weird "After you create..." like it's a prerequisite, but it's not stated anywhere that it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were using the same instruction for previous tutorials, but since this is a guide, maybe it's better to write this differently.
|
|
||
| The main reason for using indexes in a graph database is to find the starting point of a graph traversal. | ||
| The main reason for using link:https://neo4j.com/docs/cypher-manual/current/indexes/[indexes] in a graph database is to find the starting point of a graph traversal. | ||
| Once that starting point is found, the traversal relies on in-graph structures to achieve high performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To achieve high performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still sounds strange, "to achieve high performance". What "in-graph"structures" are you referring to? The actual graph structure (vs relational tables)?
|
|
||
| === Find constraints | ||
|
|
||
| First, you need to create a constraint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header says "Find restraint". It seems counterintuitive to have to create something in order to find it.
Maybe we should have an example of how to create a constraint first and then how to find it?
Co-authored-by: Jessica Wright <[email protected]>
AlexicaWright
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking shape! Some more comments.
|
|
||
| The main reason for using indexes in a graph database is to find the starting point of a graph traversal. | ||
| The main reason for using link:https://neo4j.com/docs/cypher-manual/current/indexes/[indexes] in a graph database is to find the starting point of a graph traversal. | ||
| Once that starting point is found, the traversal relies on in-graph structures to achieve high performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still sounds strange, "to achieve high performance". What "in-graph"structures" are you referring to? The actual graph structure (vs relational tables)?
| The main reason for using indexes in a graph database is to find the starting point of a graph traversal. | ||
| The main reason for using link:https://neo4j.com/docs/cypher-manual/current/indexes/[indexes] in a graph database is to find the starting point of a graph traversal and thus achieve high performance. | ||
| Once that starting point is found, the traversal relies on in-graph structures to achieve high performance. | ||
| Moreover, indexes can be added at any point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Moreover, indexes can be added at any point. | |
| Indexes can be added at any point. |
"Moreover" sounds very formal and the sentence that follows doesn't really strengthen the first paragraph, it just adds information. I'd suggest to just move the sentence to a new line for the same effect, but make it sound less formal.
| This is one of several options for query tuning, described in detail in link:{neo4j-docs-base-uri}/cypher-manual/current/query-tuning[Cypher manual -> Query tuning]. | ||
| ==== | ||
| In most cases, it is not necessary to specify which index to use when querying for data, as the appropriate indexes are used automatically. | ||
| However, you can still use index hints to specify which index to use in a particular query. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add something on why you'd want to do that when it's already done automagically?
|
|
||
| [source, cypher] | ||
| -- | ||
| SHOW INDEXES YIELD name, labelsOrTypes, properties, type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's incorrect syntax, use just SHOW INDEXES and you'll get ALL the details.
| Constraints are used to make sure that the data adheres to the rules of the domain. | ||
| For example: | ||
| link:https://neo4j.com/docs/cypher-manual/current/constraints/[Constraints] are used to make sure that the data adheres to the rules of the domain. | ||
| They can be property uniqueness contraints, property existence, property type, or key constraints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| They can be property uniqueness contraints, property existence, property type, or key constraints. | |
| They can be property uniqueness, property existence, property type, or key constraints. |
|
|
||
| |=== | ||
|
|
||
| Constraints can be added to databases that already have data in them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to say that they cannot be added to empty dbs?
| |=== | ||
|
|
||
| Constraints can be added to databases that already have data in them. | ||
| However, this requires that the existing data complies with the constraint that is being added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if existing data does not comply with an added constraint?
| -- | ||
| CREATE CONSTRAINT constraint_example_1 FOR (movie:Movie) REQUIRE movie.title IS UNIQUE | ||
| ---- | ||
| -- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth mentioning that when you create some constraints, a corresponding index is automatically created? This constraint results in a range index on the title property of movie nodes. If you run SHOW INDEXES after you create the constraint, you can see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some constraints, as in specific cases, or any constraint? Because if it's only some, then it might need more explanation, and I guess it's better to keep it short in the GSG
| If there is existing data in the database, it will take some time for an index to come online. | ||
| ==== | ||
| link:https://neo4j.com/docs/cypher-manual/current/indexes/[Indexes] are used for speeding up data retrieval and thus improve performance. | ||
| They can be added at any point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| They can be added at any point. | |
| They can be added at any time. |
| It is possible to specify which index to use in a particular query, using _index hints_. | ||
| This is one of several options for query tuning, described in detail in link:{neo4j-docs-base-uri}/cypher-manual/current/query-tuning[Cypher manual -> Query tuning]. | ||
| ==== | ||
| In most cases, it is not necessary to specify which index to use when querying for data, as the appropriate indexes are used automatically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| In most cases, it is not necessary to specify which index to use when querying for data, as the appropriate indexes are used automatically. | |
| Cypher's query planner automatically selects the appropriate index to use for your query. | |
| Only in exceptional cases do you need to specify which index to use. | |
| See link:{neo4j-docs-base-uri}/cypher-manual/current/indexes/search-performance-indexes/index-hints/[Cypher Manual -> Index hints for the Cypher planner] for more information. |
|
This PR includes documentation updates Updated pages: |
No description provided.