Fixing the SQL handling part
The algorithm for join optimisation itself is more or less complete, I believe. The problem now is that the SQL part of the program is structured in such a way that it does not allow the kind of access to queries needed for this optimisation. I have started improving that, but this means that I still haven't tested my algorithm.