Skip to content
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

Index support #1312

Open
darrellwarde opened this issue Apr 26, 2022 · 4 comments
Open

Index support #1312

darrellwarde opened this issue Apr 26, 2022 · 4 comments
Labels
feature request New feature or request

Comments

@darrellwarde
Copy link
Contributor

darrellwarde commented Apr 26, 2022

@neo4j/graphql currently supports the creation of full-text indexes, but not B-tree indexes, which can be used to improve read performance. This should probably be specified by a directive on the object type which allows the specification of multiple fields for composite indexes.

@darrellwarde darrellwarde added the feature request New feature or request label Apr 26, 2022
@neo4j-team-graphql neo4j-team-graphql added this to Feature requests in Feature Requests Apr 26, 2022
@darrellwarde darrellwarde moved this from Feature requests to Long Term in Feature Requests Apr 26, 2022
@jrsperry
Copy link

jrsperry commented Aug 9, 2022

given that b-tree indexes are deprecated will you consider having support for TEXT indexes? Another idea related to indexes is to include them (when queried for in a where clause for example) in the USING statement. This could cut down on query plan time and produce better query plans.

@darrellwarde
Copy link
Contributor Author

Whilst B-tree indexes are deprecated, they are being immediately replaced by range indexes, and the standard CREATE INDEX command will now create range indexes instead of B-tree indexes (https://neo4j.com/docs/cypher-manual/current/indexes-for-search-performance/#indexes-future-indexes).

Interesting suggestion regarding using USING, thanks for the suggestion and we'll keep it on board!

@jrsperry
Copy link

just figured i'd add in again how useful adding Query Hints could be to the queries, I have a graph with quite a few relationships, and when I have a graphql query that uses properties of nodes and traverses relationships I often get very poor planning. I took the resulting cypher and profiled it and had 10's of millions of db hits. When I added the USING Index ... on the single node property I was using in the query (and which had an index) I then only had 1100 dbhits. This was on neo4j 4.4.9, i'll test with a later version, but I was disappointed to see the query planning make such a poor plan. In the plan it was opening every single possible relationship, leading to tons of db hits as opposed to filtering by node first and then expanding the relationships.

@jrsperry
Copy link

Update, I had a property on all nodes which was always the same and was indexed, as soon as i removed that index the planner must have switched to using a different index and now everything is fast. Query Hints could still be a very nice addition though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
Development

No branches or pull requests

2 participants