Hi all.

My data presents seats in trains, which can be booked. I am struggling to 
get a search for a bookable seat reasonable fast.

Data sample:

create (source:Station {name: 'Berlin-stop-01'}), (target:Station {name: 
'Berlin-stop-02'}), (source)-[:train {trainnumber: "abc", seat: "1", 
reserved: false}]->(target)

I am using the following data scenario: 

50 stops, 50 seats, 10 different train numbers

For every seat and train number there is a relation between two stations.

The query I use is:

match p=(d:Station {name: 'Berlin-stop-01'})-[r:train*]->(a:Station {name: 
'Berlin-stop-07'})  
with head(relationships(p)) as r1,p where r1.reserved = false and all(r2 in 
relationships(p) where r2.seat=r1. seat and r2.trainnumber = 
r1. trainnumber) 
return r1 as `r` limit 1

With longer distances between the stops, the database becomes unresponsive. 
I tried to use start to fix the destination and arrival but did not get any 
major improvements.

I would appreciate any help.

Best Regards

Sebastian 

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to