Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Improvement. Boolean properties represented by Neo4j labels #567

Open
Kubera2017 opened this issue Jan 8, 2021 · 3 comments
Open

Improvement. Boolean properties represented by Neo4j labels #567

Kubera2017 opened this issue Jan 8, 2021 · 3 comments

Comments

@Kubera2017
Copy link

The idea is to use Neo4j properties to keep boolean features:
(node:User)
(node:User:User_test)

type User {
test: Boolean @labeled_property
}

This way we do NodeByLabelScan step instead of using b-tree index.

@michaeldgraham
Copy link
Collaborator

Could you share your schema and an example query? I'm not sure what you're asking for here, as GraphQL type fields correspond to Node and Relationship properties in Neo4j already, while the names of types correspond to Node and Relationship labels. It sounds like you're wanting to translate GraphQL to Cypher in a manner quite different from how it is currently supported, representing labels with both type names and field names?

@Kubera2017
Copy link
Author

Yes, keep I'm talking about an ability to keep boolean properties in labels and query it in different way.
Schema is above, for queries the idea is described below, from my perspective label selection is faster (should be faster by nature) than indexes specifically for boolean.

CREATE INDEX ON :User(test)

// query Users {
// User(filter: {test: true}) {
// id
// }
// }
PROFILE
MATCH (n:User_test)
RETURN n

PROFILE
MATCH (n:User {test: true})
RETURN n

// query Users {
// User(filter: {test: false}) {
// id
// }
// }
PROFILE
MATCH (n:User)
WHERE NOT n:User_test
RETURN n

PROFILE
MATCH (n:User {test: false})
RETURN n

@michaeldgraham
Copy link
Collaborator

#608

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

No branches or pull requests

2 participants