A little push
The first version of the selection push algorithm is now up and running. Unfortunately, it works only in some cases: '[set b | ^{#a=^a,#b=^b|^r} <bag (table "tata" with [bag {#a:pre(int),#b:pre(string),#c:pre(float)}] from db), a == 1];' works (it sends 'SELECT tata.a AS a, tata.b AS b FROM tata WHERE (tata.a = 1)' to the DBMS) but '[set x.#b | ^x <bag (table "tata" with [bag {#a:pre(int),#b:pre(string),#c:pre(float)}] from db), x.#a == 1];' doesn't.
This might not seem a very satisfactory result, but I think the problem is easy to fix, and I'm pretty confident the general structure of the optimisation is right. I hope I will be able to start the third optimisation (joins migration) early tomorrow.