« Fixing the SQL handling part | Main | Where to go now? »

December 08, 2004

Join optimisations

All right, the join merging optimisation algorithm is now working. When a 'for' operators on a DB table is nested inside the body of another 'for' operator on a DB, the optimiser will transform it into a single for operator with a join in the query.

Limsoon Wong describes in his paper "The Kleisli Approach to Data Transformation and Integration", two conditions that have to be fulfilled for the optimisation to be applied (and my current implementation requires them), but it might be something to think about:

  • The 'iteration variable' of both for loops must not be used non-projected. I believe that thanks to the more powerful records in SLinks it would be possible to optimise that also (but it is not done yet).
  • There must be an equality test between elements from the first and second table (no unconditional joins). I must admit I do not understand why this is so. Maybe experience shows that this kind of request tend to be faster unoptimised. Something to look into in more detail.