Complex SELECT in Tarantool
<p>There is two spaces, named e.g. <code>Company</code> and <code>Cars</code>. Space <code>Company</code> has company id (primary index) and geolocation (point) fields (secondary index). Space <code>Cars</code> has car (primary index) and companies (array of all companies where this car can be rented). I need to get top 10 Companies in specified rectangle where specific car can be rented. What is the (if I can say so) best solution to achieving this?</p>

<p>Here I need to combine spatial and non-spatial indexes in order to get result. My search plan is to look for car tuple and get all companies (there may be 1000 of them), and then in another space to filter 10 of the within specified rectangle.</p>

<p>My use case is something similar to this (not rent-a-car use case), but all logic is same. There will be much more Companies than cars (millions of <em>Companies</em> and 300-500k of <em>Cars</em>). How to optimize my plan in order to get these infos, what indexes to use, etc.? There need to be spatial and non-spatial conditions for one <code>select</code>, as you see.</p>