Closed canbax closed 3 years ago
Below is an example cypher query that returns both the total count of results and a slice of the results.
MATCH (x:Person)
WHERE x.birth_year >= 1990 AND x.death_year <= 2020
RETURN collect(ID(x))[10..13], collect(x)[10..13], length(collect(x))
I executed 7 different queries on a database large database (10M edges, 6M nodes)
Execution times can be seen https://docs.google.com/document/d/167WWr3vhxcfXiyhWj1MLruZpe4ow4z7SYNZ2nOffJiI/edit
Based on average execution times, I can say the single HTTP request method is slightly faster
Also, I observed that a very simple query such as "get all edges of a particular type" will result in 90 seconds in 3 HTTP requests but 40 seconds in the single HTTP request version.
Looking at the results, looks like we do sometimes get significant improvements with a single call. Let's try to do that everywhere (Query by Rule, General Queries and Custom Queries).
There are 3 places that we request data from the database with HTTP requests.
Good job. Thanks for nicely summarizing what's been done as well.
When we execute a query inside "Query By Rule" we will make 2 HTTP requests to the neo4j database server. One of them is to get the count of elements for the current query. The other one is to bring data as a table.
If the graph option is checked, we even make a third query to bring data as a graph to cytoscape.js. In fact, we can use the previous data of the table to generate graph elements. This is rather trivial.
When we bring some data which satisfies condition(s) of a "query", we only show the data partially because there might be millions of results. For pagination, we make an extra HTTP request to the neo4j database to learn the total number of elements that satisfy the rules of the "query".
Maybe we can use a single HTTP request to the server which returns partial results and also the total number of elements.