Measure Query Times

63 views
Skip to first unread message

Daniele El-Jaick

unread,
Apr 15, 2015, 4:20:28 PM4/15/15
to ne...@googlegroups.com
How can I measure query times in web interface? Every time I run the same query I get a different time. 
In java I get longer times without variation for different sizes of graphs.
Thanks

Michael Hunger

unread,
Apr 15, 2015, 4:31:01 PM4/15/15
to ne...@googlegroups.com
I usually use the neo4j-shell.

It takes a a few runs to warmup the JVM, compile the queries and create a hot-working dataset.

What times are you seeing? And what queries are you running?

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniele El-Jaick

unread,
Apr 15, 2015, 5:25:58 PM4/15/15
to ne...@googlegroups.com
Hi.
I have installed the "Neo4j Community Installer", which is
.exe packaged Windows installer with bundled JRE. I can´t find Neo Shell in it.
I am running several queries.
For example,


MATCH p= (e:ENTITY{Cod: 'E9'})-[:INFORMED|USED|DERIVED|GENERATED*]->(n) 
WITH DISTINCT p
RETURN (extract(n IN nodes(p)| n.Cod)) as Path, (extract(r IN relationships(p)|r)) as Rel

In a graph with 1.000 nodes this query times vary in web interface from 3.600 ms to 140 ms.
It depends on my internet connection, does not?

In java I got 870 ms in average.
Thanks


Michael Hunger

unread,
Apr 15, 2015, 6:19:42 PM4/15/15
to ne...@googlegroups.com
Hi,

there should be a link to the neo4j-shell under "Options" of the Starter.

Which version are you using?

can you provide a query plan with EXPLAIN MATCH ...

You can also try:

PLANNER COST MATCH ...

Michael

Am 15.04.2015 um 23:25 schrieb Daniele El-Jaick <daniej....@gmail.com>:

Hi.
I have installed the "Neo4j Community Installer", which is
.exe packaged Windows installer with bundled JRE. I can´t find Neo Shell in it.
I am running several queries.
For example,

MATCH p= (e:ENTITY{Cod: 'E9'})-[:INFORMED|USED|DERIVED|GENERATED*]->(n) 
WITH DISTINCT p
RETURN (extract(n IN nodes(p)| n.Cod)) as Path, (extract(r IN relationships(p)|r)) as Rel

All your paths should be distinct anyway, how many entries are returned?

You expand your path ad infinitum, e.g if you have 100 rels fan out and 10 steps you are at 100^10 paths.


In a graph with 1.000 nodes this query times vary in web interface from 3.600 ms to 140 ms.

It depends on my internet connection, does not?

no it does not.


In java I got 870 ms in average.
Thanks



Em quarta-feira, 15 de abril de 2015 17:31:01 UTC-3, Michael Hunger escreveu:
I usually use the neo4j-shell.

It takes a a few runs to warmup the JVM, compile the queries and create a hot-working dataset.

What times are you seeing? And what queries are you running?

Michael

Am 15.04.2015 um 21:47 schrieb Daniele El-Jaick <daniej....@gmail.com>:

How can I measure query times in web interface? Every time I run the same query I get a different time. 
In java I get longer times without variation for different sizes of graphs.
Thanks

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniele El-Jaick

unread,
Apr 15, 2015, 8:13:32 PM4/15/15
to ne...@googlegroups.com
Hi.
Under Starter I just found "settings".
I´m using version 2.1.5.
What affects the execution time of queries in Web Interface to vary like this?
Thanks a lot

Michael Hunger

unread,
Apr 15, 2015, 9:33:08 PM4/15/15
to ne...@googlegroups.com
Try 2.2.1 instead

browser roundtrip times, as you return potentially a huge amount of information also serialization, network transport, json parsing, and rendering.

Michael

Daniele El-Jaick

unread,
Apr 16, 2015, 3:18:03 PM4/16/15
to ne...@googlegroups.com
Ok, thank you.
I am just trying to undersatand why a same query, in a same graph, has very different query times in each execution. Sometimes starts with 4000 ms, and when I run again decreese to 200 ms. 
I am using neo in my doctor degree thesis.
I need to measure queries times in graphs with 1000, 5000, 1000 and 50000 nodes.
I cant get a precise time.
Each run has a time, and they are very different.
In java the times are longer, and graphs with very different sizes have very similar times for the same query.
I am looking for more precisely form to measure queries times.
Thnak you again.

Michael Hunger

unread,
Apr 16, 2015, 5:49:34 PM4/16/15
to ne...@googlegroups.com
Am 16.04.2015 um 21:18 schrieb Daniele El-Jaick <daniej....@gmail.com>:

Ok, thank you.
I am just trying to undersatand why a same query, in a same graph, has very different query times in each execution. Sometimes starts with 4000 ms, and when I run again decreese to 200 ms. 

It's a dynamic system:

- queries are compiled and planend the first time they are run and cached, (that's what you measure in the first run)
  subsequent queries are taken from that cache and executed directly

- the jvm warms up when the JIT kicks in after a while and optimizes the code
- garbage collection happens now and then

There will be no fixed time that you get for any query, my suggestion is to run it 5-10 times upfront and then measure the next 10 and take the average.

Also your graphs are tiny and shouldn't make a difference if the queries are sensible.

Michael

Daniele El-Jaick

unread,
Apr 16, 2015, 7:16:53 PM4/16/15
to ne...@googlegroups.com
Thank you!
Reply all
Reply to author
Forward
0 new messages