let's assume that we have orders, assigned orderlines.
and the query
(o:Order)-[ol:ORDERLINE]->(p:Product) return o,ol,p;
this would return for each orderline all attributes about o.
actually neo4j returns result arrays with each line having o,ol,p as keys. Well, with with respect to the transferred number of bytes this is far from beeing optimal. o properties are repeated count(ol) times for each o.
a) is it worth to care about the amount of douplicated data transferred over the wire? I guess when you have a large number of orderlines, this would certainly be the case. Imagine Orders with 50 Attributes with 20 bytes each 1000 Orderlines =1MB of Data where you would only need to transfer 1000Bytes.
b) is there a way to optimize
i am thinking of union all for header info and orderline infos.
similar questions arise when you want to query for data in a single query that has to be related to existing data and the result contains header data as well as resulting arrays/collections. The header Data would be repeated.
One reason to have one single query is about the fact that multiple queries probably introduce latency issues. And I guess they would not take adavantage of neo4js queryplanning / optimizations capabilities.