Reputation: 225
I have tow class: NOrder and NPassenger, relationship 1 : n, so NOrder has a filed named "passengers",whose type is linklist.
I want to select NOrder by NPassenger's field "passengerName", I used sql
select from NOrder where 'John' in passengers.name
the NOrder ducuments count is 3 millon, this sql works too slowly, how can I do it?
thanks a lot
Upvotes: 0
Views: 113
Reputation: 3570
You can insert an index on the field name of the class NPassenger. You can use this query
select expand(distinct(rid)) from (FIND REFERENCES (select from NPassenger where name = "John"))
Let me know.
Upvotes: 0