Someone please correct me if I am wrong, but my impression is when you do a 
query on a table such as `select from Person where ...`, orientdb will 
check every Person record to see if it complies with the where clause, and 
return it if so. Thus, wouldn't it better to query for the postcode record, 
then follow all the edges from there? ie;

select expand(both('person_lives_in_town')) from (select 
expand(both('town_has_zipcode')) from Zipcode where zip = 'LA90019')

PS - I used both() because I don't know which way the OP's in and outs go.
----
Now just as I have finished writing this, I have read the note at the 
bottom of the OP (that'll teach me for jumping the gun!). If my impression 
above is correct, and every Person record would be loaded and compared, 
then a query like described in OP would effectively load every Town linked 
to a Person, which would load every Postcode for those towns. So it is 
possible that 3 entire tables could be loaded. If this presumption is 
correct, then it would be prudent to rearrange your query as I have 
described above. Perhaps posting your actual classes would help.

On Wednesday, 5 August 2015 06:47:52 UTC+8, Simon White wrote:
>
> I know I am being stupid but could anyone help me with a simple select 
> statement spanning multiple edges?
>
>
> I have a model which looks like     PERSON -> TOWN <- ZIPCODE
>
> I am trying to select all the people that live in a named zip code but I 
> am getting no matches...
>
> *select out('person_lives_in_town').in('town_has_zipcode')[0].zip from 
> person where zip= 'LA90019'*
>
> if I do *select from town where zip = 'LA90019'* it returns the single 
> zip vertex as expected
> if I do *select out('person_lives_in_town').in('town_has_zipcode')[0].zip* 
> from person it returns a list of zip code names as expected
>
> (Note: I am unable to reverse the query to travel from zip codes back to 
> people (which logically may make more sense) because the real model is 
> actually a bit more complicated and various timestamps are involved, 
> hopefully this is a good enough demonstration example though)
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" 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