Fork me on GitHub

Oh I see. So the plan can be returned independently and executed partially?


The plan is actually just a re-ordering of the constraints. They're then executed left-to-right


The ordering is based on the data, so if a particular constraint would return a large number of items, then it gets pushed back in the execution order. If it's a small result, then it's pulled to the front


So you want to cache based on transaction and query. Once you have that result, the query execution is lazy, and you can return as soon as the first lookup is done