Hi guys,
I've followed John's suggestion on Friday, which was to combined multiple
cypher queries into 1 long query, like this:
SELECT *
FROM cypher('test_graph', $$
CREATE(:Person{id: 123, name: 'Andres', title: 'Developer', city:
'Seattle'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Brian', title: 'Researcher', city: 'Munich'})
CREATE(:Person{id: 123, name: 'Viet', title: 'Dev', city: 'Hanoi'})
$$) as (a agtype);
The problem is, if there's no RETURN clause, the function
_agtype_build_vertex will not be invoked. I checked this with the debugger.
However, if we want to have a RETURN clause, we have to name each vertex,
like a, b, c, d, whatever..., which seems impossible when we want to run
100, 1000 and 10000 queries or even more.
Also, I followed Josh's suggestions on how to use the loop. I made a new
script for it and ran 100, 1000, 10000, 100000 queries and extracted the
execution time automatically. The result, however, shocked me because the
time for optimized code is actually larger than that of the original code.

Original Optimized
100 queries 38.10308 40.473135
1000 queries 268.219235 284.259025
10000 queries 2354.88069 2436.623295
100000 queries 21843.64663 22750.658105
I'm gonna need to find a ultimate solution for this and make sure about the
repeatability as well.
Best regards,

Viet.

Reply via email to