Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-11-2019 04:23 PM
In our database we have a lot of nodes of type "Document"
MATCH (n:Document) RETURN COUNT(n) AS count
Returns
count
231266485
When queries are made using the operator = the response is fast
But we need to search only nodes containing number 8981231 and having relations with the following attributes:
MATCH (n:Document) WHERE (n.number CONTAINS '8981231') WITH n WHERE ((n)-[{someAttribute: 'linkAnalisysTest'}]-()) RETURN n.number LIMIT 10
Time to complete query
Started streaming 2 records after 10196 ms and completed after 44930 ms.
Explain (edited)
Solved! Go to Solution.
12-12-2019 01:58 PM
HI guys
We try another approach and works!!!
CALL db.index.fulltext.queryNodes('document', '*95587*') yield node AS n WITH n WHERE ((n)-[{someAttribute: 'linkAnalisys'}]-()) RETURN n.number LIMIT 10
12-11-2019 05:28 PM
Can you run a PROFILE instead, and also expand all elements of the query plan? It's the double-down arrow in the lower right of the result pane.
12-12-2019 03:50 AM
Hi! thanks for reply
Sorry for my mistake i just attached the wrong image
Explain (Correct) (Type of node is "cpf" i put "Document" to facilitate understanding
Profile
12-12-2019 09:44 AM
My guess is because the database can't do an exact match, reading from the beginning and moving on when the beginning of the attribute isn't a match, but instead the database has to examine the whole string of the attribute for the CONTAIN
operation, you're seeing more db hits? This is only speculation.
Questions:
=
and the CONTAINS
queries so we can compare the two explanations?12-12-2019 10:48 AM
Hi mike! thanks for reply
Answer the questions
Indexes
Yes we have indexes in attributes (cpf and "someAttribute")
Full Text Search
We try use Full text search but the result is the same (slow query)
Profile (=)
12-12-2019 01:58 PM
HI guys
We try another approach and works!!!
CALL db.index.fulltext.queryNodes('document', '*95587*') yield node AS n WITH n WHERE ((n)-[{someAttribute: 'linkAnalisys'}]-()) RETURN n.number LIMIT 10
All the sessions of the conference are now available online